Skip to main content
The Outlit Node.js SDK records backend product activity when you have user identity or an account ID. It supports:
  • Identified tracking - Use email or userId for user-scoped resolution
  • Customer attribution - Add customerId for account/workspace context, even before a user is known
  • Efficient batching - Events are queued and sent in batches
  • Device tracking - Use fingerprint for desktop/mobile apps (learn more)
Use it for product events that happen in your backend: feature usage from APIs, completed report exports, and background jobs. For the visitor’s first landing page, referrer, UTM data, and anonymous website activity, use the Outlit Browser SDK and identify that browser visitor when their email becomes available. An email-only server identify cannot link an otherwise anonymous browser visitor. Billing status comes from a verified integration such as Stripe.

Installation

Quick start

Configuration

Options

string
required
Your organization’s public key.
string
default:"https://app.outlit.ai"
API endpoint for sending events.
number
default:"10000"
How often to automatically flush events (milliseconds).
number
default:"100"
Maximum events per batch before auto-flush.
number
default:"10000"
HTTP request timeout in milliseconds.

API reference

outlit.track(options)

Track a custom event for a user, a customer, or both.
string
User’s email address. Resolves immediately to a customer profile.
string
Your system-owned user/contact ID.
string
Device identifier for anonymous tracking. See Device Tracking.
string
Your system-owned customer/account/workspace ID.
string
required
Name of the event. Use snake_case.
Record<string, any>
Additional data to attach to the event.
number
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.
string
User’s email address. Use this or userId to establish user-scoped identity.
string
Your system-owned user/contact ID.
string
Device identifier for linking anonymous events. See Device Tracking.
Record<string, any>
Properties to update on the user profile.
string
Your system-owned customer/account/workspace ID. Send this with email or userId to link the account/workspace to the resolved contact profile.
Record<string, any>
Properties to update on the customer profile.
At least one of email or userId is required for identify(). Customer fields are optional additions.

Lifecycle and billing

Send ordinary product facts with track(). For activation, choose the ordinary event that represents your product’s value milestone and track it after the action succeeds:
Choose this event as your activation event in Outlit. The first matching event records activation once for each eligible resolved person and company, independently. Billing status comes from verified integrations such as Stripe. See Customer journey.

outlit.flush()

Immediately send all queued events. Call this before your process exits.

outlit.shutdown()

Shut down gracefully: 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)

In serverless environments, always call flush() before returning. The function may be terminated before the background flush runs.

Stripe webhooks

Connect Stripe as a verified Outlit integration. Subscription state then updates account billing status automatically; do not translate Stripe webhooks into SDK events.

Background jobs (Bull, Agenda)

Common events to track

Here are recommended server-side events:

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 activity links across sources

Customer journey

Understand contact stages and account billing