Installation
Quick Start
Install theOutlitPlugin in your app’s entry point and use composables in components.
- With Authentication (Recommended)
- Anonymous Only
If your app has user authentication, use the
useOutlitUser composable to automatically sync user identity. This is the recommended approach as it automatically handles login/logout transitions.Using the Composable
Track custom events with theuseOutlit composable:
Plugin Configuration
OutlitPlugin
TheOutlitPlugin initializes tracking and provides context to all components.
Options
Your organization’s public key.
API endpoint for sending events.
Automatically track pageviews on route changes.
Automatically capture form submissions.
Additional field names to exclude from form capture.
How often to flush queued events (ms).
Whether to start tracking automatically. Set to
false to wait for user consent. Use enableTracking() from the useOutlit composable after consent.Automatically identify users when they submit forms containing an email field. Set to
false to disable and call identify() manually.Track engagement metrics (active time on page).
Idle timeout in milliseconds for engagement tracking.
Track booking events from calendar embeds (Cal.com, Calendly).
User Identity Patterns
TheuseOutlitUser 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 a custom event.
Identify the current visitor.
Set the current user identity. Ideal for SPA authentication flows.
Clear the current user identity (on logout).
User stage methods namespace:
user.identify(options)- Identify the useruser.activate(properties?)- Mark user as activateduser.engaged(properties?)- Mark user as engageduser.inactive(properties?)- Mark user as inactive
Customer billing methods namespace. Requires
customerId or stripeCustomerId; public calls should use customerId:customer.trialing(options)- Mark account as trialingcustomer.paid(options)- Mark account as paidcustomer.churned(options)- Mark account as churned
Get the current visitor’s ID. Returns
null if tracking is not enabled.Whether tracking is currently enabled. Will be
false if autoTrack is false and enableTracking() hasn’t been called.Enable tracking. Call this after obtaining user consent. Only needed if
autoTrack is false.Disable tracking and flush any pending events. Use this when a user declines or revokes consent.
Whether the tracker is ready.
useTrack
A convenience composable that returns just thetrack function:
useIdentify
A convenience composable that returns just theidentify function:
useOutlitUser
Automatically syncs a reactive user ref with Outlit:Consent Management
If you need to wait for user consent before tracking:Journey Stage Events
Track user progression through your product lifecycle: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