HTML 5 Video

HTML 5 video is measured using JavaScript.

To measure HTML 5 video, follow the instructions provided in Using JavaScript to Track a Video Player to configure video tracking using JavaScript. For example, add the Media Module to your s_code file, configure conversion variables, events, and milestones, and so on.

As described in Track Video Player Events, you must manually track the HTML 5 video events. The HTML 5 specification provides a large number of predefined event handlers you can use to manually track HTML 5 video. The following site provides details on the HTML 5 video events:

http://www.w3.org/2010/05/video/mediaevents.html

Using these event handlers, you can make calls to open, play, stop, and close to measure video. The following code provides some examples of using the HTML 5 video event handlers:

var video = document.getElementsByTagName('video')[0];

video.play = function(e) {
s.Media.play(mediaName,mediaOffset, segmentNum, segment, segmentLength);
}

video.pause = function(e) {
s.Media.stop(mediaName,mediaOffset);
}

video.onended = function(e) {
s.Media.close(mediaName);
}