Node.js

If you want to send data from your node.js server you can use our @seline-analytics/node library. First, install it using your package manager.

npm install @seline-analytics/node
Click anywhere to copy

Then create a tracking instance using your project token.

import { Seline } from 'seline-node';
const seline = Seline({
token: 'PROJECT_TOKEN', // Token can be found at Settings - General.
});
Click anywhere to copy

Methods

track

Track custom events using seline.track(). You can pass event name and custom properties.

seline.track({
userId: "unique-user-id", // userId is a required field
name: "order: created",
data: {
delivery: 'DHL',
total: 99.99,
},
});
Click anywhere to copy

setUser

Populates visitors with custom data and creates a profile. Great for tracking your authorized users. Read more about it at our profiles page.

seline.setUser({
userId: "unique-user-id", // userId is a required field
fields: {
plan: "enterprise",
credits: 140,
projects: ["Project A", "Project B"],
},
});
Click anywhere to copy