http://blogs.adobe.com/digitalmarketing/wp-content/uploads/2013/03/video7-player.jpg
HTML5 video player technology is gaining popularity because the player technology is supported across more browsers and devices than any other video player technology. In this post, we will look at how to implement video measurement for a very simple HTML5 video player. I believe this example will provide you with the most basic explanation of how to add analytics to your HTML5 player.
Most likely, if your video player is HTML5, it has additional code libraries associated with it that add enhancements and features beyond basic HTML code. If you are using this kind of enhanced HTML5 player, then the instructions within the Player Mapping area may need to be modified for your player. Please check with the developers and documentation for the video player code you are using.
In the previous Flash Video Measurement post, I mentioned a growing trend for Flash players to be Hybrid players, where video playback will occur within Flash when available and fall-back to using an HTML5 video player in environments where Flash is not available. Hybrid players have a very similar implementation to this HTML5 example; however, in the Player Mapping section, a Hybrid player will rely on the JavaScript API code rather than the standard HTML5 JavaScript. Again, your video player developers should provide more documentation describing how to map the player.
As covered in my basic video measurement implementation post, video tracking is all about the player technology. The player is the unifying point for all things video, from metadata to playback location, making it the ideal place to add analytics code.
Getting Started
In order to implement video analytics for your HTML5 video player, you will need the following items:
_Access to s_code.js file: _This solution requires the addition of code within the s_code.js file.
Ability to add code to your site: In addition to s_code changes, you may also need to add additional js code to the player.
A copy of t_he most recent version of the Media Module measurement library:_ The Media Module JavaScript code is currently available through tag manager or from Client Care.
Measurement Plan
I am not going to cover the measurement plan here, but I strongly encourage you to map out what aspects of video playback you need to capture and select the SiteCatalyst variables you will use before you start modifying your code. A measurement plan will help with implementation and provide documentation into the future.
Measurement Library
After designing a measurement plan, reach out to Client Care and request the latest version of the Media Module JavaScript code. The Media Module will need to be added to your s_code file below the plug-ins area. See an example of the Media Module in this s_code.js file for the sample player. If you are using Tag Manager, you don’t need to copy and paste the Media Module code. Instead, add the Video Tracking component found under Product Code > SiteCatalyst > Video Tracking to automatically add the measurement library.
Player Mapping
In order for the Media Module library to know when video playback is happening, we need to map the HTML5 video events to the Media Module code. There are two pieces to this, (1) adding event listeners and (2) calling the Media Module functions when the video events occur. View source on the sample player to see the player mapping.
The W3C has defined standards for video events. More information is available here: http://www.w3.org/2010/05/video/mediaevents.html. In my sample player I am looking for play, seeked, seeking, pause, and ended. I have assigned my video player element on the page the id value of “movie”. The chunk of code that looks for the video player events is the following:



