PRODUCT
Follow

Overview

The HTML5 Video module enables the ad to send video-related metrics to the server for use in reports.

To use the Video module, you must load by adding it to the EBModulesToLoad array.

<script>EBModulesToLoad = ['Video'];</script>

Next you need to initialize the module by instantiating it and passing a reference to your HTML video tag to its constructor, like this:


var video = document.getElementsByTagName("video")[0];
var videoTrackingModule = new EBG.VideoModule(video);

Afterwards, tracking the video is done automatically with two exceptions.

  • If you want your reports distinguish between auto-initiated and user-initiated video, you can specify that the video was started with a user interaction by calling the .playVideo() method.

    Note: Video is typically tracked as auto-initiated because Sizmek cannot intercept clicks on the native HTML video-player controls. Sizmek reports video start based on the play or playing events from the video. Sizmek cannot determine if the video was triggered by a click on the controls or by the native JavaScript .play() method. In most cases, creatives are designed so that video can only be either auto- or user- initiated, not both. The report recipient understands this difference.

  • Currently, there is only support for the full-screen API in WebKit-supported browsers (Chrome, Safari, Edge).

videoTrackingModule.playVideo()

Description

Causes the video to start playing, allowing it to be tracked as user-initiated.

Code Syntax

videoTrackingModule.playVideo(userInitiated);

Parameters
Name Type Description
userInittiated Boolean (Optional) Determines whether the video was triggered by a user interaction, such as a click. Default value is false.
Example

var video = document.getElementsByTagName("video")[0];
var videoTrackingModule = new EBG.VideoModule(video);
var playButton = document.getElementById('play-button'); 

playbutton.addEventListener("click", onVideoPlayClick);
function onVideoPlayClick(event) {
    videoTrackingModule.playVideo(true);
}
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments