@circulare/usage-tracker-node
v0.0.2
Published
A usage tracking library for nodejs
Maintainers
Readme
Introduction
Tracking library based on Mixpanel's SDK, focused on event tracking.
Getting Started
To start tracking events, first install the library via npm install --save @circulare/usage-tracker-node and import it and initialize it as follows:
const usageTrackerNode = require('usage-tracker-node');
const usageTracker = usageTrackerNode.init('TOKEN'); // Mixpanel's project tokenThe token passed to .init() is the project token on your Mixpanel account. More information on how to locate the project token can be found here.
Once the tracker is initialized and knows to which project to redirect the events, you can start tracking them by passing an event name and the properties you wish to track:
const usageTrackerNode = require('@circulare/usage-tracker-node');
const usageTracker = usageTrackerNode.init('TOKEN'); // Mixpanel's project token
usageTracker.track('List Users', {
endpoint: '/users',
requestedAt: 'timestamp',
accountId: 'accountId',
});