An event is any important occurrence in the user journey that you want to track. Evolv provides interfaces for common events, such as visiting pages and clicking on page elements. For more advanced or custom interactions, you can use the emitEvent()
method to send additional event signals to Evolv.
You can manually trigger events by adding emitters to your code. Emitters allow you to trigger custom events that you've configured in the Evolv management interface. Events can be triggered in any experiment.
To trigger an event, use the evolv.runtime.emitEvent
method and pass the name of the event. This will also fire the TriggeredEvent
lifecycle hook.
For example, imagine you want to fire an event when a user finishes playing an embedded video. You can create a custom Evolv event named videoWatched
, then use the following JavaScript to attach the event to the video's ended
event:
document.getElementById('player').addEventListener('ended', function() {
evolv.runtime.then(function(runtime) {
runtime.emitEvent('videoWatched');
});
})
Generated using TypeDoc