Skip to main content

Installation

Quick Start

Add Outlit to your base layout:
Add your public key to .env:

Alternative: Inline Script

Use an inline script for better performance:

Tracking Events

Track events in Astro components:

With Client Directives

Use client directives for interactive components:

Framework Islands

React Island

Vue Island

Svelte Island

Identifying Users

Identify users after authentication:

Auth State Management

For apps with authentication, use setUser() and clearUser() to sync user identity:
Using setUser() ensures the user identity persists across page navigations and is properly set when users return to your site already logged in.

View Transitions

Track navigation with Astro’s View Transitions:

API Routes

Track events from API endpoints:
For server-side tracking, see the Node.js integration guide.

SSR Pages

For SSR pages, ensure tracking runs client-side:

Content Collections

Track interactions with content:

Activation event

Track activation after the user completes your product milestone:
Configure this ordinary event as your activation signal. Outlit Core derives activation, engagement, and inactivity; billing comes from verified integrations such as Stripe. See Customer Journey.
Handle user consent:

Environment Variables

Configure environment variables:
Keep server environment variables out of client-side code. Only use OUTLIT_KEY in API routes.

TypeScript Support

Full TypeScript support is included:

Next Steps

Server-Side Tracking

Track events from your backend

Identity Resolution

Learn how profiles are merged

NPM Package

Full API reference

React Integration

Use Outlit with React