Skip to content

Custom Events

Track custom user interactions with the Fusionaly API

For custom events, user actions, or additional data collection, you can use our JavaScript API.

Track specific user interactions or milestones not covered by automated tracking using the sendCustomEvent function.

Syntax: Fusionaly.sendCustomEvent(eventName, metadata)

  • eventName (string): A unique name for your event (e.g., “trial_started”, “file_downloaded”).
  • metadata (object): An object containing any additional dynamic information relevant to the event. You can include any key-value pairs, for example, { plan: "premium", fileName: "report.pdf" }. This data will be available in your analytics.

Example:

Fusionaly.sendCustomEvent("video_played", {
videoTitle: "Product Demo",
durationWatched: "60s",
});

SPA frameworks could fail to automatically trigger page views changes, you can do it manually like this:

window.Fusionaly.sendPageView();
document.querySelector('#contact-form').addEventListener('submit', function(e) {
Fusionaly.sendCustomEvent('form_submitted', {
form_name: 'contact_form',
form_type: 'inquiry'
});
});
video.addEventListener('play', function() {
Fusionaly.sendCustomEvent('video_started', {
video_id: 'demo-video',
video_title: 'Product Demo'
});
});
video.addEventListener('ended', function() {
Fusionaly.sendCustomEvent('video_completed', {
video_id: 'demo-video',
video_title: 'Product Demo'
});
});
function onFeatureUsed(featureName) {
Fusionaly.sendCustomEvent('feature_used', {
feature: featureName,
timestamp: new Date().toISOString()
});
}