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

publicKey
string
required
Your organization’s public key.
apiHost
string
default:"https://app.outlit.ai"
API endpoint for sending events.
trackPageviews
boolean
default:"true"
Automatically track pageviews on route changes.
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 flush queued events (ms).
autoTrack
boolean
default:"true"
Whether to start tracking automatically. Set to false to wait for user consent. Use enableTracking() from the useOutlit composable after consent.
autoIdentify
boolean
default:"true"
Automatically identify users when they submit forms containing an email field. Set to false to disable and call identify() manually.
trackEngagement
boolean
default:"true"
Track engagement metrics (active time on page).
idleTimeout
number
default:"30000"
Idle timeout in milliseconds for engagement tracking.
trackCalendarEmbeds
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

track
(eventName: string, properties?: object) => void
Track a custom event.
identify
(options: IdentifyOptions) => void
Identify the current visitor.
setUser
(identity: UserIdentity) => void
Set the current user identity. Ideal for SPA authentication flows.
clearUser
() => void
Clear the current user identity (on logout).
user
object
User identity and activation namespace:
  • user.identify(options) - Identify the user
  • user.activate(properties?) - Mark user as activated
customer
object
Customer billing methods namespace. Use customerId for public billing calls:
  • customer.trialing(options) - Mark account as trialing
  • customer.paid(options) - Mark account as paid
  • customer.churned(options) - Mark account as churned
getVisitorId
() => string | null
Get the current visitor’s ID. Returns null if tracking is not enabled.
isTrackingEnabled
Ref<boolean>
Whether tracking is currently enabled. Will be false if autoTrack is false and enableTracking() hasn’t been called.
enableTracking
() => void
Enable tracking. Call this after obtaining user consent. Only needed if autoTrack is false.
disableTracking
() => void
Disable tracking and flush any pending events. Use this when a user declines or revokes consent.
isInitialized
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:
If you need to wait for user consent before tracking:

Activation

Track user progression through your product lifecycle:
user.activate() requires the user to be identified first. Use useOutlitUser(), setUser(), or identify() before calling it.
Use track() for product activity. Outlit handles engagement and inactivity automatically; see Customer Journey.
Account billing status (customer.paid, customer.churned, customer.trialing) is tracked separately at the account level. If you’ve connected Stripe, this is handled automatically.

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 profiles are merged

NPM Package

Full API reference