Skip to main content

Installation

Initialization

Initialize the tracker once at app startup, typically in your entry point:

Configuration Options

publicKey
string
required
Your organization’s public key from Settings → Website Tracking.
apiHost
string
default:"https://app.outlit.ai"
The API endpoint for sending events. Override for self-hosted or proxy setups.
trackPageviews
boolean
default:"true"
Automatically track pageviews on navigation.
trackForms
boolean
default:"true"
Automatically capture form submissions.
formFieldDenylist
string[]
Additional field names to exclude from form capture.
flushInterval
number
default:"5000"
How often to send batched events (in milliseconds).
autoTrack
boolean
default:"true"
Whether to start tracking automatically on init. Set to false if you need to wait for user consent. Call enableTracking() after consent is obtained.
autoIdentify
boolean
default:"true"
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.
trackEngagement
boolean
default:"true"
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.
idleTimeout
number
default:"30000"
Idle timeout in milliseconds for engagement tracking. After this period of no user interaction, the user is considered idle and active time stops accumulating.
trackCalendarEmbeds
boolean
default:"true"
Track booking events from calendar embeds (Cal.com, Calendly). Fires a calendar event when bookings are detected.
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.
eventName
string
required
A descriptive name for the event. Use snake_case.
properties
Record<string, string | number | boolean | null>
Additional data to attach to the event.

outlit.identify(options)

Identify the current visitor. Links their anonymous history to a known profile.
email
string
The visitor’s email address. Primary identifier.
userId
string
Your internal user ID (from Supabase, Auth0, etc.).
traits
Record<string, string | number | boolean | null>
Additional properties about the user.
customerId
string
Your system-owned customer/account/workspace ID. Send this when the visitor belongs to a known account.
customerTraits
Record<string, string | number | boolean | null>
Additional properties about the customer/account profile.

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.

Activation event

Track the ordinary event selected as your activation signal after the milestone succeeds:
Configure this event as your activation signal. Outlit Core derives activation, engagement, and inactivity from ordinary events. Billing status comes from verified integrations such as Stripe. See Customer Journey.

outlit.getInstance()

Get the singleton tracker instance.

outlit.enableTracking()

Enable tracking after consent. Only needed if autoTrack: false was set during init.

outlit.disableTracking()

Disable tracking and flush any pending events. Use this when a user declines or revokes consent.

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:

Disabling Engagement Tracking

Next Steps

React Integration

Use the React provider and hooks

Server-Side

Track events from your backend