Tracking
How Fusionaly tracks user interactions
Add the Script. You’re Done.
Section titled “Add the Script. You’re Done.”Page views and button clicks are tracked the moment you add the script. No configuration, no attributes, no setup.
- Page views: Every page load and SPA navigation
- Button clicks: Named from visible text —
button:submit,button:cancel_order, etc.
That’s convention over configuration. The right defaults, out of the box.
Want More? One Attribute.
Section titled “Want More? One Attribute.”When you want to track something specific, add data-fusionaly-event-name to any element. The SDK does the right thing based on 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 | Enter key and button click both work. Button tracking is suppressed inside — no double events |
| Any other element | Scroll into view | Fires when 50% of the element is visible in the viewport. Fires once per page load |
One attribute. Same everywhere. The SDK does the right thing based on element type.
Adding Metadata
Section titled “Adding Metadata”Need more context? Add data-fusionaly-metadata-* attributes:
<button data-fusionaly-event-name="revenue:purchased" data-fusionaly-metadata-price="2999" data-fusionaly-metadata-product="pro_plan"> Upgrade to Pro</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 can’t be expressed in HTML attributes, use the JavaScript API:
Fusionaly.sendCustomEvent("video_completed", { videoId: "demo", watchTime: 120});Most tracking should use data attributes. The JS API is for the cases where HTML isn’t enough.