PRODUCT
Follow

Overview

The HTML Video module enables the ad to send video-related metrics to the server for use in reports, while using the native browser player.

Follow these steps to use the Video module.

Procedure
  1. Load the module by adding it to the EBModulesToLoad array.

    <script>EBModulesToLoad = ['Video'];</script>
  2. Use the following code to link the HTML video element to the video module. (This example assumes videoElement is a variable that points to the HTML video element to track.)

    var videoTrackingModule = new EBG.VideoModule(videoElement);

After this procedure, tracking the video is done automatically, with two exceptions:

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

  • If you want your reports to 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. Video is typically tracked as auto-initiated because the module cannot intercept clicks on the native HTML video-player controls.

Methods

videoTrackingModule.playVideo

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

Code Syntax

videoTrackingModule.playVideo(isUserInitiated);

Parameters

Name

Type

Description

isUserInitiated

Boolean

(Optional) Determines whether the video was triggered by a user interaction, such as a click. Default value is false.

videoTrackingModule.setVideoSrc

Update the video asset that is tracked by the video module.

Code Syntax

videoTrackingModule.setVideoSrc(video_asset);

Parameters

Name

Type

Description

video_asset

Relative or absolute path to video asset.

Path to the video asset to be tracked.

Events

Event Name

Description and Usage (to trigger event manually)

FULLPLAY

Fired when the video has reached the end.

EB.videoInteraction(EBG.VideoInteraction.FULLPLAY, theVideo.src, isUserInitiated);

FULLSCREEN_END

Fired when the video plays to the end while the player is in full-screen mode.

EB.videoInteraction(EBG.VideoInteraction.FULLSCREEN_END, theVideo.src, isUserInitiated);

FULLSCREEN_MUTE

Fired when the video is muted while the player is in full-screen mode.

EB.videoInteraction(EBG.VideoInteraction.FULLSCREEN_MUTE, theVideo.src, isUserInitiated);

FULLSCREEN_PAUSE

Fired when the video is paused while the player is in full-screen mode.

EB.videoInteraction(EBG.VideoInteraction.FULLSCREEN_PAUSE, theVideo.src, isUserInitiated);

FULLSCREEN_START

Fired when a video is started for the first time while the player is in full-screen mode.

EB.videoInteraction(EBG.VideoInteraction.FULLSCREEN_START, theVideo.src, isUserInitiated);

MUTE

Fired when the video is muted.

EB.videoInteraction(EBG.VideoInteraction.MUTE, theVideo.src, isUserInitiated);

PAUSE

Fired when the video is paused.

EB.videoInteraction(EBG.VideoInteraction.PAUSE, theVideo.src, isUserInitiated);

PERCENT_25_PLAYED

Fired when the video has reached the first quartile.

EB.videoInteraction(EBG.VideoInteraction.PERCENT_25_PLAYED, theVideo.src, isUserInitiated);

PERCENT_50_PLAYED

Fired when the video has reached the second quartile.

EB.videoInteraction(EBG.VideoInteraction.PERCENT_50_PLAYED, theVideo.src, isUserInitiated);

PERCENT_75_PLAYED

Fired when the video has reached the third quartile.

EB.videoInteraction(EBG.VideoInteraction.PERCENT_75_PLAYED, theVideo.src, isUserInitiated);

REPLAY

Fired when the video is replayed after the first full play.

EB.videoInteraction(EBG.VideoInteraction.REPLAY, theVideo.src, isUserInitiated);

SLIDER_DRAGGED

Fired when the user completed dragging the video play head to a new position.

EB.videoInteraction(EBG.VideoInteraction.SLIDER_DRAGGED, theVideo.src, isUserInitiated);

STARTED

Fired when a video started playing for the first time.

EB.videoInteraction(EBG.VideoInteraction.STARTED, theVideo.src, isUserInitiated);

UNMUTE

Fired when video is unmuted.

EB.videoInteraction(EBG.VideoInteraction.UNMUTE, theVideo.src, isUserInitiated);

UNMUTED

Fired when the video is not muted alongside the video started event.

EB.videoInteraction(EBG.VideoInteraction.UNMUTED, theVideo.src, isUserInitiated);

USER_INITIATED_VIDEO

Fired when the video is started by a user. This event is only tracked once per impression.

EB.videoInteraction(EBG.VideoInteraction.USER_INITIATED_VIDEO, theVideo.src, isUserInitiated);

Example

Was this article helpful?
1 out of 1 found this helpful
Have more questions? Submit a request

Comments