Learn more about the Vemetric Node.js SDK in the official docs.
You can also checkout the NPM Package.
npm install @vemetric/nodeimport { Vemetric } from '@vemetric/node';
const vemetric = new Vemetric({
token: 'YOUR_PROJECT_TOKEN',
});
// Track an event
await vemetric.trackEvent('MyCustomEvent', {
userIdentifier: 'user-id',
userDisplayName: 'John Doe',
eventData: { key: 'value' },
});
// Update user data
await vemetric.updateUser({
userIdentifier: 'user-id',
userData: {
set: { key1: 'value1' },
setOnce: { key2: 'value2' },
unset: ['key3'],
},
});The client can be configured with the following options:
const vemetric = new Vemetric({
token: 'YOUR_PROJECT_TOKEN', // Required
host: 'https://hub.vemetric.com', // Optional, defaults to https://hub.vemetric.com
});