Skip to main content

Installation

Quick start

Create a client component to initialize Outlit:
Add to your root layout:
Add your public key to .env.local:
For a better experience with React hooks, use the React provider:
See the React integration guide for full React provider documentation.

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, call outlit.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:
For server-side tracking, see the Node.js integration guide.

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:
Keep server environment variables out of client-side code. Only use OUTLIT_KEY in server components, API routes, or server actions.

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