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 event data
Every visibility event includes these numeric properties:
| Property | Example | Meaning |
|---|---|---|
visibility_percentage | 80 | The actual visible portion of the element when the event was sent, expressed from 0 to 100. |
threshold | 0.7 | The configured visibility ratio required to qualify, expressed from 0.1 to 1. |
delay | 700 | How long the element had to remain continuously visible before the event was sent, in milliseconds. |
For the example above, Talivia sends event data equivalent to:
{
"visibility_percentage": 80,
"threshold": 0.7,
"delay": 700
}threshold and visibility_percentage use different scales: 0.7 means a 70% threshold, while
an observed value is stored as 70 or higher. delay is the required continuous-visible duration,
not a timestamp. These properties work like any other event data 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.