0.0.2 • Published 7 months ago
@circulare/usage-tracker-node v0.0.2
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 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:
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',
});