Strongly-typed analytics app for use in Node projects.
You will need to have configured segment as per these instructions before using this package.
You can install this by running:
npm i @bufferapp/buffer-tracking-node
Next you'll need to add the dependency to the desired file, alongside the existing segment configuration:
const typewriter = require('@bufferapp/buffer-tracking-node')
const Analytics = require('analytics-node')
const analytics = new Analytics('YOUR_WRITE_KEY')
You'll then need to provide our typewriter app with a reference to the segment analytics-node reference:
typewriter.setTypewriterOptions({
analytics: analytics
})
And finally, you can use the typewriter reference to call the desired tracking functions:
typewriter.shopGridLinkRemoved({
userId: userId,
properties: {
product: 'publish',
channel: 'instagram',
channelId: '12345679',
channelServiceId: '987654567898',
linkText: 'hiii',
linkURL: 'www.buffer.com'
}
})
When calling these functions, any violations or errors will be logged to your console.
If the library does not reflect the latest tracking changes then you can trigger a rebuild manually. Head over to this URL and select the Run Workflow option. After a few minutes, the latest release should be pushed to NPM.