Dynamically Track YouTube Videos with Adobe Analytics – No Development Required

The Adobe Analytics YouTube Player Video Measurement Library will enable you to track video consumption on your site using the YouTube iFrame Player API. If you are comfortable using Adobe DTM, you can deploy all the code you need directly through DTM without having to make any code changes on your site.

Prerequisites:

  • YouTube videos deployed on your site using the iFrame embed option

  • Adobe DTM

  • Adobe Analytics AppMeasurement JS

  • 1 Prop, 3 eVars, and 7 Events

Data Collected:

  • Video Name

  • Video Segment

  • Video Start Event

  • Video Time Viewed

  • Video Segment Viewed

  • Video Played 25% Event

  • Video Played 50% Event

  • Video Played 75% Event

  • Video Complete Event

Adobe Analytics Setup

The first thing we will want to do is to go into Adobe Analytics and enable all of the variables we will use to track YouTube video consumption on our site. Navigate to Report Suite Admin and add/configure the following variables:

  1. Custom Traffic Variable (Video Name)

  2. Custom Conversion Variable (Video Name)

  3. Custom Conversion Variable (Video Segment Name)

  4. Custom Conversion Variable (Video Content Type)

  5. Custom Event (Video Start)

  6. Custom Event (Video 25%)

  7. Custom Event (Video 50%)

  8. Custom Event (Video 75%)

  9. Custom Event (Video Complete)

  10. Custom Event (Video Time Viewed)

  11. Custom Event (Video Segment View)

Update ALL YouTube Embeds On Your Site

Yikes! This part of the implementation has historically been a real challenge. The Adobe Analytics YouTube Library requires two attributes be present on every YouTube video on your site you wish to track — Every embedded YouTube URL needs to have ‘&enablejsapi=1’ appended to the query string of the video, this allows the Adobe Media Module to communicate with the YouTube API and each video needs an id of ‘playerN’, where N denotes a sequential number of the player if you have multiple videos embed on a page e.g. player1, player2, player3, etc.

So not only do you need to audit all of your pages to make these required changes and have the changes made before you can start tracking your YouTube Videos, you also need to remember to add these attributes with every new video you embed and if you forget, the video won’t be tracked.

Thankfully, utilizing the power of Adobe DTM, we have a way of automating this whole process. No going back and updating all your video embed code. No needing to remember to update your embed code for new videos you add to your site.

In Adobe DTM, within the Adobe Analytics configuration section, add the following code to your Custom Code. This code should appear before the rest of the video tracking code we will add next:

This block of code will dynamically add the required code to enable the YouTube JavaScript API to all of your YouTube videos. In addition, the player id will be dynamically created, based on the number of YouTube videos you have embed on each page, and applied to each player.

Add the Adobe Analytics Media Module Library

If you haven’t already, you will need to deploy the Adobe Analytics Media Module for YouTube tracking to work properly. This Module can be easily deployed using Adobe DTM. Copy and Paste the module into your Analytics Code Library, if you have it hosted in DTM, or update your Code library directly on your servers.

Add YouTube Tracking Modules

The final step is to add the required YouTube Tracking Modules, there are 3 of them, to Adobe DTM. I would recommend adding these blocks of code, in the order they appear, directly under the Adobe Analytics YouTube Player Video Measurement Helper Function code, again utilizing the Custom Page code function within Adobe DTM.

YouTube Player Mapping

YouTube iFrame JavaScript API

Add and Update the Adobe Analytics Media Module Configuration

NOTE: This section requires you to update the configuration to align with the variables we created earlier in this tutorial in order for the data collection to function properly.

And that is it! If you are familiar with Adobe Launch, you can utilize this process to deploy YouTube Tracking, using Adobe Analytics, across your entire site in less than an hour.

jason thompson

Jason Thompson is the CEO and co-founder of 33 Sticks, a boutique analytics company focused on helping businesses make human-centered decisions through data. He regularly speaks on topics related to data literacy and ethical analytics practices and is the co-author of the analytics children’s book ‘A is for Analytics’

https://www.hippieceolife.com/
Previous
Previous

Digital Data Layer Strategies

Next
Next

Python for Business: Identifying Duplicate Data