All Collections
Analytics and Tracking
Track Sales With Smartzer - Analytics Share Extension
Track Sales With Smartzer - Analytics Share Extension

Discover how you can track sales that come from your Smartzer Video or Livestream

D
Written by Dan Davis
Updated over a week ago

We have an optional Analytics Share extension that allows you to read events from the player and tie these in with a user who made a purchase. This means that you can see whether a user made a purchase following their interaction with the video. The two events we can currently send via a PostMessage are the “impression” and the “startPlayback”.

Data is shared via a postMessage from the iFrame to the page containing the iFrame.The postMessage contains an object with the following data:

  • Type: “smrtzr_analytics”

  • Analytics:

    • type: “analytic type”

    • projectId: 12345

Currently, two analytics types are shared:

  • Impression (When the player loads)

  • StartPlayback (When a user clicks play to trigger video playback)

Access the data on the page containing the iFrame

  1. Add the code below to the page containing the iFrame.

  2. Replace ‘yourCustomAnalyticsFunction’ with the function that will handle the analytics data.

if (!window.smrtzrPostMessageAnalytics) {
window.smrtzrPostMessageAnalytics = true;
window.addEventListener('message', (msg) => {
if (msg.data.type === 'smrtzr_analytics') {
// handle custom analytics code here
yourCustomAnalyticsFunction(msg.data.analytics);
} });
}

Did this answer your question?