NodeJS receiver for zpl.track event tracking library.
Introduction
zpl.track is a cross-platform event tracker that can send your event data to a UDP echo server. It aims to be very minimalist and easy to integrate.
You can find the C99 library here.
This library serves as a receiver for zpl.track that you can use to collect telemetry data. You can then pipe the telemetry data to any destinations desired.
How to use this library?
const track = require('zpl.track')
const host = process.env.HOST || null
const port = process.env.PORT || 8200
const prot = process.env.PROT_KIND || 'udp6'
track.init(prot)
track.on('event', ({userId, event, properties}) => {
console.log(`Event: ${event} from [${userId}]: ${JSON.stringify(properties)}`)
})
track.on('ident', ({userId, traits}) => {
console.log(`User: ${userId} with traits: ${JSON.stringify(traits)}`)
})
track.on('group', ({userId, groupId, traits}) => {
console.log(`User: ${userId}, group: ${groupId} with traits: ${JSON.stringify(traits)}`)
})
track.on('error', (err, msg) => {
console.error(err)
if (msg) console.error(msg)
})
track.bind(port, host)
License
See LICENSE for the license.