This post is authored by David Vallejo.
Brighcove is an online video platform that allows to embed onDemand videos on your websites. It seems there’re out of there some people looking for a way to track it, so we’re going to learn how to track those videos within Google Tag Manager.
In order to be able to track our videos from BrightCove we need to have some things in mind:
- API needs to be enabled within BrightCove Interface.
- Embeds needs to have includeAPI and templateLoadHandler params in place.
First Step: Enabling the JS API for our videos
This needs to be done within BrightCove Site for all the different players that we may have, follow these steps:
- Go to your Video Cloud Studio Publishing Module and then select your player
- Click on the Setting link
Second Step: GTM Configuration
For being able to track BrightCove videos, we’re going to use 1 Custom HTML tag, 1 Trigger and 1 Variable.
First let’s create the Variable, this one will allow us to know when a BrightCove Video is present on a page, to we just fire the tracking script when it’s needed. We don’t want to inject the tracking code were is not going to be used:
Now, we’re going to create the Trigger that is going to fire our tracking code. Just to be safe, we’re going to fire it on DomReady and when our previusly created Variable equals to “yes”.
Ok, now let’s add the tracking tag (you’ll be able to copy the js code from the post bottom):
We’re done. Remember to test this code in preview before going live.
This script will track the following events:
- Progress (25% steps, it can be personalized within the code)
We’ve used an agnostic dataLayer push, with a lot of extra info about the video in the case you need it, like the related thumbnail, the video length, the video coded, the video name, the publisher info, check the following screenshot for a guide of all info you may use for your custom dimensions: