[Spott] Capture javascript events

 

The performance of a spott is measured on all embedded interactive content.  Spott measures every interaction, impression, video play, and click events. All these measurements can be captured on your local website or can be seen in the Spott Dashboard.

 

This article will show you how to capture Spott events

 

Capturing custom events 

You can measure Spott's performance by putting a code snippet into your webpage, which enables you to integrate your custom event tracking.

 

Code Snippet

Simply copy-paste this code snippet and put it at the bottom of your web page.

<script>
window.addEventListener('message', function (message) {
if (message.data && message.data.event_type === 'spottInteractionEvent'){
/* Your custom tracking here */
}
});
</script>

In this snippet, the script won't do anything just yet. Replace /* Your custom tracking here */  with your own Javascript event tracking or with the Google Analytics snippet below.

Try replacing /* Your custom tracking here */  with console.log(message.data), and open your console to see what data you can use to track events.

The list of event types are:

  • spottPlayEvent  > When a user starts playing a video
  • spottImpressionEvent > when the project is inside the viewport of the visitor
  • spottInteractionEvent > when a user interacts with an interactive layer
  • spottButtonAction > when a user clicks on an interactive layer