simplified_strategy.js is a template for creating a strategy class with no external dependencies. The comments in the code explains what each of the methods in the strategy class need to do.
strategy_interface.js is a Google Closure implementation of the strategy interface. If you’re using Google Closure, it defines all the required methods for you. Using Google Closure is not a requirement if you use the
simplified_strategy.js as a basis for your object.
strategy_html_player.js is an example file showing how Chartbeat implemented the video strategy constructor for HTML5 video players.
On each page with embedded video, you will need to push your video strategy constructor—as customized in
strategy_interface.js — so that Chartbeat's pinger can use it to watch for video events. For the constructor, “CUSTOM_STRATEGY_CONSTRUCTOR”, you would push the constructor like this:
window['_cbv_strategies'] = window['_cbv_strategies'] || ;window['_cbv_strategies'].push(CUSTOM_STRATEGY_CONSTRUCTOR_NAME);
Whenever a new video player loads on the page, push the video object to _cbv. This should come after you’ve pushed your video strategy constructor, as in Step 1. For each individual video player, push the video object as below:
var _cbv = window._cbv || (window._cbv = ); _cbv.push(player);
Make sure to do this for each player that loads. So if a single page has two separate video players, you’ll need to push twice. However, if the same video player switches to a new video, you do not need to make this push, as the strategy interface should take care of new video loads.
In order to use the Video Pinger, you must modify the Chartbeat code already on your site. You'll want to switch the Chartbeat code to load
chartbeat_video.js instead of
chartbeat_video.js file includes both Publishing and Video tracking capabilities.
Your complete Chartbeat code will look something like this: