Skip to main content

Installation

Quick start

Install the OutlitPlugin in your app’s entry point and use composables in components.
Set your public key in .env:

Using the composable

Track custom events with the useOutlit composable:

Plugin configuration

OutlitPlugin

The OutlitPlugin initializes tracking and provides context to all components.

Options

string
required
Your organization’s public key.
string
default:"https://app.outlit.ai"
API endpoint for sending events.
boolean
default:"true"
Automatically track pageviews on route changes.
boolean
default:"true"
Automatically capture form submissions.
string[]
Additional field names to exclude from form capture.
number
default:"5000"
How often to flush queued events (ms).
boolean | "auto"
default:"\"auto\""
Controls when tracking starts. "auto" (default) asks the Outlit edge endpoint whether the visitor’s region requires opt-in consent: tracking enables automatically outside the EEA, UK, and Switzerland, and stays off in those regions or when the region can’t be determined. The check fails closed on errors. true enables immediately; false waits for enableTracking() from the useOutlit composable. isTrackingEnabled updates automatically when auto mode enables tracking asynchronously.
boolean
default:"true"
Automatically identify users when they submit forms containing an email field. Set to false to disable and call identify() manually.
boolean
default:"true"
Track engagement metrics (active time on page).
number
default:"30000"
Idle timeout in milliseconds for engagement tracking.
boolean
default:"true"
Track booking events from calendar embeds (Cal.com, Calendly).

User identity patterns

The useOutlitUser composable is the recommended way to handle user identity. It’s simpler and more reliable than manual identify() calls because:
  • Automatic lifecycle management: Login/logout transitions are handled automatically
  • Reactive: Uses Vue’s reactivity system to sync with your auth state
  • Cleaner code: No need for watchers with manual setUser() calls

Pattern 1: with Pinia store

Pattern 2: with composable auth

When the user ref changes (login/logout), useOutlitUser automatically calls setUser() or clearUser() internally. You don’t need to call these methods manually.

Composables

useOutlit

The primary composable for tracking events and identifying users.

Returns

(eventName: string, properties?: object) => void
Track a custom event.
(options: IdentifyOptions) => void
Identify the current visitor.
(identity: UserIdentity) => void
Set the current user identity. Ideal for SPA authentication flows.
() => void
Clear the current user identity (on logout).
object
User identity namespace:
  • user.identify(options) - Identify the user
() => string | null
Get the current visitor’s ID. Returns null if tracking is not enabled.
Ref<boolean>
Whether tracking is currently enabled. Will be false until enableTracking() is called when autoTrack is false, while the "auto" region check is pending, or when that check requires consent or fails.
() => void
Enable tracking. Call this after obtaining user consent. Needed when autoTrack is false, or in the default "auto" mode when the visitor’s region requires consent or the region check fails.
() => void
Disable tracking and flush any pending events. Use this when a user declines or revokes consent.
Ref<boolean>
Whether the tracker is ready.

useTrack

A convenience composable that returns just the track function:

useIdentify

A convenience composable that returns just the identify function:

useOutlitUser

Automatically syncs a reactive user ref with Outlit:
The default autoTrack: "auto" mode already keeps tracking off for visitors in regions that require opt-in consent (EEA, UK, Switzerland, or unknown). enableTracking() — typically wired to your consent banner’s accept action — is what grants consent and is persisted for future sessions. To wait for enableTracking() instead — unless a previous opt-in is stored:

Activation event

Track your value milestone as an ordinary event once it succeeds:
Choose this 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.

Vue Router integration

Track pageviews automatically with Vue Router:
If you set trackPageviews: true during plugin install (default), pageviews are tracked automatically. Vue Router’s History API changes are detected by the SDK.

Pinia integration

Track state changes with Pinia:

TypeScript support

Full TypeScript support is included:

SSR with Nuxt

For Nuxt applications, see the dedicated Nuxt integration guide.

Next steps

Nuxt integration

Use Outlit with Nuxt 3

Server-side tracking

Track events from your backend

Identity resolution

Learn how visits and events link to people

npm package

Full API reference