Installation
Quick start
- App Router
- Pages Router
Create a client component to initialize Outlit:Add to your root layout:
.env.local:
Using the React provider (recommended)
For a better experience with React hooks, use the React provider:Tracking events
Track custom events in client components:With React provider
Activation event
Track your value milestone as an ordinary event once it succeeds. For example, after your export action confirms completion, calloutlit.track('report_exported', { format: 'csv' }) from the client component. Choose that 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.
Identifying users
Identify users after authentication:Server-side auth integration
With NextAuth
With Clerk
With Supabase
Server actions
Track events from server actions:API routes
Track events from API routes:Middleware
Don’t track in middleware: it cannot reliably respect the visitor’s consent choice or guarantee delivery, and it can double-count pageviews the Outlit Browser SDK already sends. Use browser pageview tracking for page activity and@outlit/node in Server Actions or Route Handlers for server events, where you can await outlit.flush() (see the Outlit Node.js SDK guide).
Environment variables
Set up your environment variables:TypeScript support
Full TypeScript support is included:Next steps
React provider
Full React integration guide
Server-side tracking
Track events from your backend
Identity resolution
Learn how visits and events link to people
npm package
Full API reference
