Installation
Initialization
Initialize the tracker once at app startup, typically in your entry point:Configuration Options
Your organization’s public key from Settings → Website Tracking.
The API endpoint for sending events. Override for self-hosted or proxy setups.
Automatically track pageviews on navigation.
Automatically capture form submissions.
Additional field names to exclude from form capture.
How often to send batched events (in milliseconds).
Whether to start tracking automatically on init. Set to
false if you need to wait for user consent. Call enableTracking() after consent is obtained.Automatically identify users when they submit forms containing an email field. Extracts email and name using field name heuristics. Set to
false to call identify() manually. See Auto-Identify for details.Track engagement metrics (active time on page). Emits engagement events on page exit and SPA navigation capturing how long users actively engaged with each page.
Idle timeout in milliseconds for engagement tracking. After this period of no user interaction, the user is considered idle and active time stops accumulating.
Track booking events from calendar embeds (Cal.com, Calendly). Fires a calendar event when bookings are detected.
Consent Management
If you need to wait for user consent before tracking:Check Tracking Status
API Reference
outlit.init(options)
Initialize the tracker. Must be called before other methods.
outlit.track(eventName, properties?)
Track a custom event.
A descriptive name for the event. Use
snake_case.Additional data to attach to the event.
outlit.identify(options)
Identify the current visitor. Links their anonymous history to a known profile.
The visitor’s email address. Primary identifier.
Your internal user ID (from Supabase, Auth0, etc.).
Additional properties about the user.
outlit.setUser(identity)
Set the current user identity. Ideal for SPA applications where you know the user’s identity after authentication. Can be called before tracking is enabled—the identity is queued and applied when enableTracking() is called.
Both
setUser() and identify() link the visitor to a known profile. The difference is setUser() can be called before tracking is enabled (identity is queued), while identify() requires tracking to be enabled first.outlit.clearUser()
Clear the current user identity. Call this when the user logs out.
Journey Stage Methods
Track user progression through your product lifecycle. These require the user to be identified first (viasetUser() or identify()).
outlit.activate(properties?)
Mark the current user as activated. Typically called after a user completes onboarding or a key activation milestone.
outlit.engaged(properties?)
Mark the current user as engaged. Typically called when a user reaches a usage milestone.
outlit.paid(properties?)
Mark the current user as paid. Typically called after a successful payment or subscription.
outlit.churned(properties?)
Mark the current user as churned. Typically called when a subscription is cancelled.
outlit.getInstance()
Get the singleton tracker instance.
outlit.enableTracking()
Enable tracking after consent. Only needed if autoTrack: false was set during init.
outlit.isTrackingEnabled()
Check if tracking is currently enabled.
TypeScript Support
The package is written in TypeScript and includes full type definitions:Framework Examples
Next.js (App Router)
Vue.js
Svelte
Advanced Usage
Manual Flush
Force immediate sending of queued events:Shutdown
Gracefully shutdown the tracker (flushes remaining events):Access Visitor ID
Get the current visitor’s ID for server-side correlation:Engagement Tracking
Engagement tracking captures how long users actively spend on each page. It’s enabled by default and works automatically.How It Works
- Active time is tracked when the page is visible and the user is interacting (mouse movement, clicks, scrolling, typing)
- Idle detection pauses active time after 30 seconds of no interaction (configurable via
idleTimeout) - Engagement events are automatically sent when the user navigates to a new page or leaves the site
Engagement Data
Each engagement event includes:| Property | Description |
|---|---|
activeTimeMs | Time in milliseconds the user was actively engaged |
totalTimeMs | Total wall-clock time on the page |
sessionId | Session ID for grouping page views |