Server-side analytics tracking SDK for Node.js applications.
# pnpm (recommended)
pnpm add @entro314labs/node
# npm
npm install @entro314labs/node
# yarn
yarn add @entro314labs/node
# bun
bun add @entro314labs/nodeimport { Entrolytics } from '@entro314labs/node';
// Create client instance
const client = new Entrolytics({
websiteId: 'your-website-id',
hostUrl: 'https://cloud.entrolytics.click', // or your self-hosted URL
});
// Track a page view
await client.trackPageView({
url: '/dashboard',
title: 'Dashboard',
referrer: 'https://google.com',
});
// Track a custom event
await client.trackEvent({
url: '/products',
name: 'add_to_cart',
data: {
productId: 'prod_123',
price: 29.99,
currency: 'USD',
},
});const client = new Entrolytics({
// Required
websiteId: 'your-website-id',
hostUrl: 'https://cloud.entrolytics.click',
// Optional
sessionId: 'custom-session-id',
userAgent: 'MyApp/1.0',
timeout: 10000,
endpoint: 'standard', // 'standard' | 'edge' | 'native'
});| Option | Type | Default | Description |
|---|---|---|---|
websiteId |
string |
- | Your Entrolytics website ID (required) |
hostUrl |
string |
- | Entrolytics host URL (required) |
sessionId |
string |
- | Custom session identifier |
userAgent |
string |
Auto-generated | Custom user agent for requests |
timeout |
number |
10000 |
Request timeout in milliseconds |
endpoint |
string |
'standard' |
API endpoint variant |
Track a page view event.
await client.trackPageView({
url: '/page-path',
title: 'Page Title',
referrer: 'https://...',
hostname: 'example.com',
language: 'en-US',
screen: '1920x1080',
});Track a custom event with optional data.
await client.trackEvent({
url: '/page-path',
name: 'event_name',
data: {
key: 'value',
count: 42,
},
});Flexible tracking method.
// Track with event name
await client.track('button_click');
// Track with event name and data
await client.track('purchase', { amount: 99.99 });
// Track with full options
await client.track({
url: '/checkout',
name: 'purchase_complete',
data: { orderId: 'order_123' },
});Identify a user/session with custom properties.
await client.identify({
sessionId: 'session_abc123',
userId: 'user_456',
plan: 'premium',
});client.setProperty('userId', 'user_123');
client.setProperties({ plan: 'enterprise', region: 'us-west' });
const props = client.getProperties();
client.clearProperty('region');
client.reset();import {
Entrolytics,
EntrolyticsOptions,
EntrolyticsPayload,
EventData,
TrackPageOptions,
TrackEventOptions,
IdentifyOptions,
SendType,
} from '@entro314labs/node';const client = new Entrolytics({
websiteId: 'your-website-id',
hostUrl: 'https://analytics.yourdomain.com',
});const client = new Entrolytics({
websiteId: 'your-website-id',
hostUrl: 'https://cloud.entrolytics.click',
endpoint: 'edge',
});- Node.js >= 22.x
MIT