Tracker functions
Use window.talivia to track page views, events, identity, and checkout session context.
The tracker exposes a small browser API after the script loads.
Track a page view
window.talivia.track();Use this when automatic tracking is disabled or when you need to manually send a page view after a route transition.
Track a custom event
window.talivia.track('signup-button');Event names are limited to 50 characters.
Track an event with data
window.talivia.track('signup-button', {
plan: 'pro',
location: 'pricing',
});Event data can include strings, numbers, arrays, and nested objects. Keep payloads small: Talivia truncates long strings and limits object shape so reports stay fast.
Override page properties
window.talivia.track({
website: 'YOUR_WEBSITE_ID',
url: '/pricing',
title: 'Pricing',
});Use a function
window.talivia.track(props => ({
...props,
url: '/checkout',
title: 'Checkout',
}));The function receives the current tracker payload and returns the payload to send.
Identify a visitor
window.talivia.identify('user_123', {
email: 'founder@example.com',
stripeCustomerId: 'cus_123',
});Use identify after login or signup. Talivia stores session data and can connect a payment provider customer to the visitor.
Read checkout context
const talivia = window.talivia.getSession();
await fetch('/api/create-checkout', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ talivia }),
});getSession() returns website, visitorKey, sessionKey, sessionId, and a cache token. Send this to your backend before creating checkout.