Create a javascript event

The performance of a spott is measured on all embedded interactive content. In a reliable and secure way, Spott measures every interaction from video impressions to product clicks. All these measurements can be found on the Spott reporting dashboard.

In order to measure the conversion rate (e.g. how many purchases were made by Spott), you can capture custom events with your own tracking solution. 

This article will show you how to implement custom 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. The custom event you added will get fired whenever a user clicks on a product in your interactive content.

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 === 'spottButtonAction'){
/* 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.

 

Common use cases

Some of the most common possible uses of custom JavaScript events include:

  • 'Add to cart' or 'Save in wish list' functionality.
  • Link spott with your targeted advertising solution.
  • Keep track of events in your own user tracking system (such as Google Analytics).
  • Change (part of) your page layout.
  • Open custom page dialogs.
Was this article helpful?
1 out of 1 found this helpful

Comments

0 comments

Article is closed for comments.