Google Tag Manager

Track YouTube Videos with Google Tag Manager

Google Tag Manager has launched in 2017 three very useful new User Engagement triggers. These triggers help you track video views, user scrolling and what your users are seeing on your pages. This post will show you step-by-step how to setup the new YouTube Video Trigger.

The YouTube Video trigger allows you to track several different user actions on videos on your website. These user actions are:

  • Starting the video
  • Completing the video
  • Pausing the video
  • Watching through a certain point in the video. These points can either be a percentage of the video length or a specific amount of time.

In this tutorial, we will show you how to setup a Google Analytics Event Tag to capture all this information. To do this we will configure a few variables, create a lookup table and setup the GA Event tag and YouTube Video trigger.

Step 1: Configure the Video Variables

Along with the new YouTube Video Trigger GTM has added several new built-in variables specifically for YouTube Videos. You will need to setup 3 of these to capture information about the videos.

  1. In GTM navigate to the Variables section.
  2. The top part of the Variables section is for Built-In Variables. In this section click the Configure button.
  3. In the menu that opens; scroll down and check:
    1. Video Status
    2. Video Title
    3. Video Percent
Video Variables

Step 2: Create the Video Status Lookup Table

The Video Status variable will capture what action the user has taken on the video. However, Google does not populate this variable in the most user friendly format. We will create a lookup table to rectify this.

  1. In the Variables section create a new User-Defined Variable.
  2. Click the Variable Configuration block.
  3. Select the variable type Lookup Table.
  4. Set the Input Variable to the Video Status variable.
  5. Add Rows and fill in the values for the Input and Output as depicted in the screenshot above. Note that the Video Watched Output field includes the Video Percent variable. This is selected by clicking the plus box on the right of the Output field.
  6. Give the lookup table the title: ‘Video Status Lookup Table’.
  7. Save the variable.
Video Lookup Table

Step 3: Create the Trigger

The next step is to create the YouTube Video trigger.

  1. Navigate to the Triggers section of GTM and click the New button.
  2. Click in the Trigger Configuration Section.
  3. Choose YouTube Video Trigger.
  4. In the capture selection make sure all four checkboxes are checked:
    1. Start
    2. Complete
    3. Pause, Seeking and Buffering
    4. Progress
  5. When you check the Progress option a radio button will appear. Leave this as Percentages.
  6. Fill in 25,50,75 into the textbox. This will track when the user has watched 25%, 50% and 75% of your video.
  7. Check the checkbox for Add JavaScript API support.
  8. Give the trigger the title: ‘YouTube Video Trigger’.
  9. Save the Trigger.
Video Trigger

Step 4: Create the Google Analytics Event Tag

The final step will be to create the tag that sends the video events to Google Analytics.

  1. Navigate to the Tags section of GTM.
  2. Click the New Button.
  3. Click on the Tag Configuration block.
  4. Choose the Universal Analytics Tag Type from the menu.
  5. Change the Track Type to Event using the Dropdown menu.
  6. In the Category field type ‘Videos‘.
  7. For the Action field click the Plus box on the right and select the Video Status Lookup Table variable.
  8. For the Label field click the Plus box on the right and select the Video Title variable.
  9. Under Google Analytics Settings either select your Settings Variable or Enable Overriding and insert your UA ID number.
  10. Click on the triggering section and select your YouTube Video trigger.
  11. Give your tag the title: ‘YouTube Video Tag’.
  12. Save the tag.
Video Tag

You have now completed the setup and can publish your tag. GTM will now send events to Google Analytics whenever the user starts, pauses or completes a video. It will also send an event whenever a user watches 25%, 50% and 75% of the way through your videos. This allows you to see how far through your video users are watching.

We will soon be publishing blog posts that show you how to setup and use the other new User Engagement triggers: Scroll Depth and Element Visibility.

If you have any questions about the new YouTube Video Trigger and how to use it then please send me an email.