Quickstart
Install the SDK and send your first event in under 5 minutes.
Step 1 — Install the SDK
Install the @prodlytix/js package via npm or yarn:
$ npm install @prodlytix/js
$ yarn add @prodlytix/js
Step 2 — Initialize with your API key
Import and call plx.init() with your API key. This should run once when your application loads.
import plx from '@prodlytix/js';
plx.init('plx_live_yourApiKey');
Find your API key in Settings → API Keys in your Prodlytix dashboard. Use a plx_live_ key for production and a plx_test_ key for development.
Step 3 — Identify your users
Call plx.identify() when a user logs in or when you know their identity. Pass a stable user ID and any properties that help you segment later.
plx.identify(user.id, {
email: user.email,
plan: user.subscription.plan,
signup_date: user.createdAt,
company_size: user.company.employeeCount
});
Step 4 — Track events
Call plx.track() whenever a user takes an action you want to measure. Use consistent, lowercase, underscore-separated event names — e.g. dashboard_viewed, filter_applied, export_created. Inconsistent event naming degrades auto-discovery accuracy.
// Track a feature interaction
plx.track('dashboard_viewed', {
page: 'retention_overview',
filter_applied: true
});
// Track an export
plx.track('export_created', {
format: 'csv',
row_count: result.count
});
That's it. Events will appear in your Prodlytix dashboard within seconds. Auto-discovery will run its first analysis within 4 hours of receiving sufficient event volume (at least 100 unique users with at least 3 events each).
Event naming matters for auto-discovery. The algorithm detects sequences by matching exact event name strings. If the same user action is tracked as export_created in one place and exportCreated in another, auto-discovery treats them as different events. Establish a tracking plan before you go to production.