Tracking
How Fusionaly tracks user interactions
Add the Script
Section titled “Add the Script”Page views and button clicks work as soon as you add the script. You do not need any configuration, attributes, or setup.
- Page views: Every page load and every SPA navigation
- Button clicks: Named from the visible text, for example
button:submit,button:cancel_order
This follows convention over configuration. Fusionaly uses sensible defaults from the start.
Track More With One Attribute
Section titled “Track More With One Attribute”To track something specific, add data-fusionaly-event-name to any element. The SDK picks the right behavior for each element type:
<button data-fusionaly-event-name="signup_clicked">Sign Up</button><a href="/pricing" data-fusionaly-event-name="pricing_viewed">Pricing</a><form data-fusionaly-event-name="contact_submitted">...</form><section data-fusionaly-event-name="testimonials_seen">...</section>| Element | Trigger | Notes |
|---|---|---|
| Button | Click | Overrides the auto-generated name |
| Link | Click | Uses sendBeacon. Fires even if the user navigates away. |
| Form | Submit | Works on Enter key and button click. Button tracking is suppressed inside a form, so you do not get double events. |
| Any other element | Scroll into view | Fires when 50% of the element is visible in the viewport. Fires once per page load. |
You use one attribute the same way everywhere.
Adding Metadata
Section titled “Adding Metadata”To add context to an event, add data-fusionaly-metadata-* attributes:
<button data-fusionaly-event-name="revenue:purchased" data-fusionaly-metadata-price="2999" data-fusionaly-metadata-product="annual_plan"> Buy now</button>
<a href="/trial" data-fusionaly-event-name="trial_signup_clicked" data-fusionaly-metadata-source="hero_cta"> Start Free Trial</a>
<form data-fusionaly-event-name="demo_requested" data-fusionaly-metadata-plan="enterprise"> ...</form>Beyond Clicks
Section titled “Beyond Clicks”- Section Tracking: Fire events when visitors see specific sections (scroll into view at 50% visibility)
- Revenue Tracking: Track purchases with
data-fusionaly-event-name="revenue:purchased"and price/currency metadata
JavaScript API (Escape Hatch)
Section titled “JavaScript API (Escape Hatch)”For dynamic data that HTML attributes cannot express, use the JavaScript API:
Fusionaly.sendCustomEvent("video_completed", { videoId: "demo", watchTime: 120});Use data attributes for most tracking. Use the JavaScript API only when HTML attributes are not enough.