Skip to content

Custom Integrations ​

When the Parent Window integration is enabled for a Videobot, it sends events to the parent page using iframe messages. To learn more about how they work, see this guide on MDN.

This allows the parent page to listen to analytics events and forward them to any third party analytics platform.

Setting Up ​

First, the Parent Window integration should be enabled for the Videobot. It can be found from the dashboard, within the Videobot Settings tab, under the Tracking & analytics heading.

After the feature is enabled, the Videobot will start sending analytics events via iframe messages. To forward these messages to the data layer, the following script can be used:

html
<script>
  window.addEventListener('message', function(event) {
    if (event.origin !== 'https://videobot.com') {
      return
    }
    if (event.data.action !== 'VIDEOBOT_ANALYTICS_EVENT') {
      return
    }
    window.dataLayer.push(
      Object.assign({ event: event.data.eventName }, event.data.data)
    )
  })
</script>

The above script does the following:

  1. Listens to all iframe postMessage events
  2. Ensures they come from the Videobot domain
  3. Filters to events related to analytics
  4. Sends the event to the Google Analytics data layer

Further Reading ​

To understand what types of events will be sent by Videobot, refer to the Supported Events article.