Brightcove Smart Video Measurement


This post is part of an on-going series on video mea­surement tips, tricks, and best practices.


video8-BC-playerBrightcove is a popular video platform that offers solutions for publishing and distribution of digital media.  Adobe has partnered with Brightcove to provide video measurement solutions for the Brightcove video players.  If you are a Brightcove customer, bringing video playback data into your general site and app analytics is critical to seeing a complete picture of your content consumption and monetization.

This post covers a new video measurement solution that utilizes Brightcove’s Smart Player technology.  Brightcove Smart Players enable you to use a single Video Cloud player to deliver your video in Flash or HTML5.  Our video measurement solution combines the SiteCatalyst JavaScript library with the Brightcove Smart API to track video playback in both Flash and HTML5 using a single measurement implementation.  This solution will provide video measurement across devices, including iOS.  You can find a sample player running the measurement script here.

Since the new solution uses JavaScript hosted on your website, it does not provide video tracking for viral or off-site embedded players.  For many years we have provided a Flash based tracking solution for Brightcove players, and we still do.  The Flash-only solution can be found within the SiteCatalyst video documentation and is a great option for measuring viral video playback.  In my next post, I will cover how to implement tracking for a Brightcove off-site embedded player.

Getting Started

In order to imple­ment video ana­lyt­ics for your Brightcove video player, you will need the fol­low­ing items:

Access to s_code.js file:  This solu­tion requires the addi­tion of code within the s_code.js file.

Abil­ity to add code to your site: In addi­tion to s_code changes, you may also need to modify the video player code.

Brightcove Account with Admin Access:  The solution requires some settings to be made within the Brightcove Video Cloud administration.

A current s_code version:  The solution requires H code version H24 for higher.

A copy of the most recent ver­sion of the Media Mod­ule mea­sure­ment library:  The Media Mod­ule JavaScript code is cur­rently avail­able through tag man­ager or from Client Care.

Measurement Plan

I am not going to cover the mea­sure­ment plan here, but I strongly encour­age you to map out what aspects of video play­back you need to cap­ture and select the Site­Cat­a­lyst vari­ables you will use before you start mod­i­fy­ing your code.  A mea­sure­ment plan will help with imple­men­ta­tion and pro­vide doc­u­men­ta­tion into the future.

Consider including some of the available Brightcove meta-data in your tracking plan.  Items such as tags, reference id, player name, player type, and playlist id are included in this solution.  Other data points are also available within the Brightcove Smart API and are easy for any developer to implement with additional JavaScript.

Measurement Library

After design­ing a mea­sure­ment plan, reach out to Client Care and request the lat­est ver­sion of the Media Mod­ule JavaScript code; which should be added to your s_code file below the plug-ins area.  (You can see an exam­ple of the Media Mod­ule in this s_code.js file for the sam­ple player.) If you are using Tag Man­ager, you don’t need to copy and paste the Media Mod­ule code. Instead, add the Video Track­ing com­po­nent found under Prod­uct Code > Site­Cat­a­lyst > Video Track­ing to auto­mat­i­cally add the mea­sure­ment library.

Player Mapping

There are three steps to the Brightcove player mapping: modifying the settings within the Video Cloud, calling the video player correctly on your page, and adding the Brightcove Smart Analytics plug-in to your s_code file.

The video player you select within the Brightcove Video Cloud must have HTML5 and API delivery enabled to use the measurement solution.  To turn these on for your selected player, log into your Brightcove Video Cloud account, then go to “Publishing”, select the player, and open the settings menu.  In the “Global” tab for the settings menu, check the two “Web Settings” boxes to enable JavaScript APIs and HTML5 Delivery.  Once selected and saved it may take a few minutes to take effect.


Once the player settings are correct, edit the page level code used to call the Brighcove video player.  The page level code needs to call the BrightcoveExperiences.js file.  Two additional parameters must also be set within the player object, the includeAPI and the templateLoadHandler.  See the page level code within the sample player.


Next, add the Brightcove Smart Plug-in to your s_code file within the plug-ins area.  The plug-in code maps the Brightcove player events to the SiteCatalys Media Module functions.  The code can be grabbed from the sample player’s s_code file.

Pay careful attention to the notes found within the code.  The video title and player name are both required variables but can be modified to match your desired formatting and values.  The plug-in code contains optional variables for Brightcove meta-data, which can be commented out if the meta-data is not part of your measurement plan.  This is also the best location for adding additional meta-data points.

Variable Mapping

With the plug-in code in place, the Media Module functions will fire when specific player events occur.  The final implementation step is to add the video variable mapping to your s_code file.  Follow your measurement plan for the proper frequency and variable usage.  In the sample player I am setting quartiles and adding all the plug-in meta-data points.


A few things to note about this sam­ple code:

Enable Video Track­ing:  I rec­om­mend wrap­ping the vari­able map­ping in a true/false vari­able.  In this exam­ple I am using s.enableVideoTracking.  This allows a devel­oper to eas­ily turn on and off the video track­ing and also con­tains the vari­able map­ping within one function.

Track Vars:  Make sure to include all the vari­ables and events in the s.Media.trackVars and s.Media.trackEvents vari­ables or the vari­ables may not show up in your track­ing calls.

Auto Track:  s.Media.autoTrack is set to false because we added player spe­cific event lis­ten­ers in the player map­ping code.


After completing implementation, load your files into a browser and use a packet sniffer to check the tracking calls.  You should see two groups of context data variables; is for the default video tracking variables and bc_ is for the Brightcove plug-in variables.  All the context variables can be mapped to SiteCatalyst variables by using the processing rules within SiteCatalyst.


Final Notes

This Brightcove plug-in is a new solution and is being actively improved by Adobe and Brightcove.  Right now, there is a known bug with buffering.  If the video begins to buffer, the media module timer may get out of sync with the video player head.  This can cause the video complete event to fire before the video has completed playback.  Additionally, the video player name is currently static and must be set within the s_code.  In future releases, the video player name will be pulled from the Brightcove meta-data.

If you add new meta-data hooks to this solution or make other changes, please leave a comment.  This will help us continue to improve the solution.