zpl.track

1.0.4 • Public • Published
zpl

discord

NodeJS receiver for zpl.track event tracking library.
Brought to you by @zpl-zak, @inlife and contributors

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.

Readme

Keywords

Package Sidebar

Install

npm i zpl.track

Weekly Downloads

0

Version

1.0.4

License

BSD-3-Clause

Unpacked Size

8.46 kB

Total Files

5

Last publish

Collaborators

  • zaklaus