1.0.4 • Published 11 months ago

zpl.track v1.0.4

Weekly downloads
-
License
BSD-3-Clause
Repository
github
Last release
11 months ago

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.

1.0.4

11 months ago

1.0.3

11 months ago

1.0.2

11 months ago

1.0.1

11 months ago

1.0.0

11 months ago