Overview
The Node.js SDK is designed for server-side tracking where you have user identity. It supports:- Identified tracking - Use
emailoruserIdfor user-scoped resolution - Customer attribution - Add
customerIdfor account/workspace context, even before a user is known - Efficient batching - Events are queued and sent in batches
- Device tracking - Use
fingerprintfor desktop/mobile apps (learn more)
Use server-side tracking for events that happen in your backend: subscription changes, feature usage from APIs, background jobs, etc.
Installation
Quick Start
Configuration
Options
Your organization’s public key.
API endpoint for sending events.
How often to automatically flush events (milliseconds).
Maximum events per batch before auto-flush.
HTTP request timeout in milliseconds.
API Reference
outlit.track(options)
Track a custom event for a user, a customer, or both.
User’s email address. Resolves immediately to a customer profile.
Your system-owned user/contact ID.
Device identifier for anonymous tracking. See Device Tracking.
Your system-owned customer/account/workspace ID.
Name of the event. Use
snake_case.Additional data to attach to the event.
Unix timestamp in milliseconds. Defaults to current time.
At least one of
email, userId, fingerprint, or customerId is required for track(). customerId-only events are valid immediately and can later link to a resolved customer when identify() uses the same customerId with an email.outlit.identify(options)
Update user traits without tracking an event. Customer metadata can be included alongside the user identity.
User’s email address. Use this or
userId to establish user-scoped identity.Your system-owned user/contact ID.
Device identifier for linking anonymous events. See Device Tracking.
Properties to update on the user profile.
Your system-owned customer/account/workspace ID. Send this with
email or userId to link the account/workspace to the resolved contact profile.Properties to update on the customer profile.
At least one of
email or userId is required for identify(). Customer fields are optional additions.Contact Stage Methods
Track contact progression through your product lifecycle. These methods require at least one offingerprint, email, or userId.
outlit.user.activate(options)
Mark a contact as activated. Typically called after a user completes onboarding or a key activation milestone.
outlit.user.engaged(options)
Mark a contact as engaged. Typically called when a user reaches a usage milestone. Can also be computed automatically based on activity.
outlit.user.inactive(options)
Mark a contact as inactive. Use this when a user’s engagement has lapsed.
The
discovered and signed_up stages are automatically inferred from identify calls.Account Billing Methods
Track account billing status. These methods target the account bycustomerId, not individual contacts. If you’ve connected Stripe, billing is handled automatically.
outlit.customer.trialing(options)
Mark an account as trialing.
outlit.customer.paid(options)
Mark an account as paying.
outlit.customer.churned(options)
Mark an account as churned.
Billing methods target accounts by
customerId. Contacts linked to that customer share the same billing status. See Customer Journey for details on how contact stages and account billing work together.outlit.flush()
Immediately send all queued events. Call this before your process exits.
outlit.shutdown()
Gracefully shutdown: flushes remaining events and stops the timer.
outlit.queueSize
Get the number of events waiting to be sent.
Framework Examples
Express.js
Next.js API Routes
Serverless Functions (AWS Lambda, Vercel)
Stripe Webhooks
If you’ve connected Stripe to Outlit, billing status is handled automatically—you don’t need to implement webhook handling yourself. The example below is only needed for custom billing logic.
Background Jobs (Bull, Agenda)
Common Events to Track
Here are recommended server-side events:| Event | When | Properties |
|---|---|---|
subscription_created | New subscription | plan, price, interval |
subscription_upgraded | Plan upgrade | fromPlan, toPlan, mrr |
subscription_cancelled | Cancellation | reason, mrr_lost |
payment_succeeded | Payment received | amount, currency |
payment_failed | Payment failed | amount, error_code |
feature_used | Feature usage | feature, count |
api_key_created | API key created | keyName, permissions |
export_completed | Data export | format, rowCount, size |
invite_sent | Team invite | inviteeEmail, role |
user_role_changed | Permission change | fromRole, toRole |
Error Handling
The SDK silently handles errors to not disrupt your application. For debugging:TypeScript Support
Full TypeScript support is included:Next Steps
Identity Resolution
Learn how profiles are merged across sources
Customer Journey
Understand contact stages and account billing