Skip to main content

Overview

The Node.js SDK is designed for server-side tracking where you have user identity. 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 server-side tracking for events that happen in your backend: subscription changes, feature usage from APIs, background jobs, etc.

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:
Outlit Core derives activation from the customer-selected ordinary event and derives engagement and inactivity from activity. 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()

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)

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 authoritative SDK billing commands.

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 profiles are merged across sources

Customer Journey

Understand contact stages and account billing