Track events
Track important user actions with HTML attributes or JavaScript.
Use custom events for actions that matter more than a page view: signups, checkout clicks, demo requests, external links, and activation steps.
HTML attributes
Add data-talivia-event to an element:
<button data-talivia-event="signup-click">Start free trial</button>Add event data with data-talivia-event-* attributes:
<button
data-talivia-event="checkout-click"
data-talivia-event-plan="pro"
data-talivia-event-location="pricing"
>
Checkout
</button>Talivia automatically reads these attributes on click.
Track when an element becomes visible
Add data-talivia-visible to any element that matters: a pricing section, CTA, banner, alert, or modal.
<section data-talivia-visible="pricing-seen">
<h2>Simple pricing</h2>
</section>Talivia sends the pricing-seen event once per page view when 50% of the element is visible.
Use optional attributes when the default is not right for an element:
<button
data-talivia-visible="signup-cta-seen"
data-talivia-visible-threshold="0.7"
data-talivia-visible-delay="700"
>
Start free trial
</button>data-talivia-visible-thresholdaccepts0.1through1. The default is0.5.data-talivia-visible-delaywaits for the element to remain visible before sending the event. The default is0milliseconds.
Visibility events include visibility_percentage, threshold, and delay in their event data. They work like any other Talivia event in Sessions, Goals, and Funnels.
Links
For normal links, Talivia waits for the event request before navigating when possible.
<a href="/pricing" data-talivia-event="pricing-link">Pricing</a>External links, modifier-key clicks, and _blank links are not blocked.
JavaScript
window.talivia.track('invite-sent', {
role: 'viewer',
});Use JavaScript when the event depends on application state, form results, or a server response.
Event data tips
- Use stable names like
signup-click, not user-facing button text. - Keep numeric values as numbers when you want to compare them later.
- Avoid sending personal information unless it is needed for payment attribution and allowed by your privacy policy.