A usage tracking library for nodejs
npm install @circulare/usage-tracker-nodeTracking library based on Mixpanel's SDK, focused on event tracking.
To start tracking events, first install the library via npm install --save @circulare/usage-tracker-node and import it and initialize it as follows:
``js
const usageTrackerNode = require('usage-tracker-node');
const usageTracker = usageTrackerNode.init('TOKEN'); // Mixpanel's project token
`
The 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:
`js
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',
});
``