Track Events
Capture named events with custom properties to measure any user action.
Events are the core unit of data in Helion. Each event represents a discrete user action — a button click, a form submission, a purchase — and can carry arbitrary properties that give context to the action.
Tracking an event
Call the track method on your Helion instance with an event name.
hl.track('button_clicked');Adding properties
Pass a properties object as the second argument to attach context to the event.
hl.track('signup_button_clicked', {
location: 'header',
color: 'blue',
variant: 'primary',
});Supported property types
| Type | Example |
|---|---|
string | 'header', 'premium' |
number | 29.99, 3 |
boolean | true, false |
Tracking with data attributes
To track click events without JavaScript, add data-track and optional property attributes to any HTML element.
<button
data-track="signup_clicked"
data-location="header"
>
Sign Up
</button>Helion will fire a signup_clicked event with { location: 'header' } whenever this element is clicked. Data attribute tracking is enabled when trackAttributes: true is passed to init.