Sunday, 08 December 2019 19:57

Video Tracking with Google Tag Manager | GTM Video Tracking

Written by
Rate this item
(0 votes)

Time to update an old post on tracking YouTube Videos with the built in Google Tag Manager variables and triggers.  Google has made it very easy to track videos when they are embedded on your website.

Variables

We can start in any order we prefer so let enable the variables first.  First let's configure the built in variables.  We only select the ones we want - it helps a little with performance and there is no need to clutter our workspace with unused variables:

Google Tag Manager Configure Video Variables

The variables we will configure provide this information:

  • Video Provider - in this case it will always be 'youtube' since this is a youtube tracking variable.
  • Video Status - this is the status of our video used by the trigger and available for our tag.  So 'play', 'pause', 'progress', 'complete', 'pause', 'seek', and 'buffer'
    • The 'progress' status is for percent or time progress.
    • 'pause' indicates the user has clicked on the Pause button - you can use the current time or percent to see when people are clicking this button.
    • 'seek' indicates when people click to move back or forward in your videos.  Again the current time or percent will indicate where people have moved to in your video.
  • Video URL - the YouTube URL for the embedded video.
  • Video Title - The title of the video in YouTube.  I like to use this in a Google Analytics event 
  • Video Duration - the total duration of the video in seconds.
  • Video Current Time - this is the current time in seconds when the video status is updated.  So at 'play' it will be 0 seconds, at the 'pause' and 'seek' statuses you can use this variable to see when people are pausing or skipping.
  • Video Percent - the percentage at a specific status.  The 'progress' status will fire at your predefined percentages (or times).
  • Video Visible - 'true' when the user is viewing the video.  (Not the same as an element visible variable - which is true if the video is visible within the browser window.)

Trigger

Then we will want to created our trigger:

Google Tag Manager Configure Video Trigger

In the Trigger there are a lot of interesting options.

  • The Capture options let us choose when this trigger will fire.
    • Start records when the start button is clicked.
    • Complete when the video is watched to the end.
    • Pause, Seeking, Buffering will fire when a user clicks on the pause button, clicks to scroll forward or back in a video (Seeks) and if the video is buffering when playing.
    • Progress - can fire on percent progress or duration time in seconds progress - we typically prefer percentage as this will work for long and short videos without having to alter the trigger.  But if say all your videos are 40 minutes or 30 seconds the time thresholds may work well for you.
    • Add JavaScript API support - this is provided in case the YouTube API is not loaded on the webpage already.  The trigger and variables require this API to function properly.
    • All Videos / Some Vidoes - this radio button will allow you to track all videos or just specific videos or groups of videos.  The Some Videos provides the standard GTM variables and criteria to fine tune your tracking.

Tag (and one more Variable!)

So now we have everything set to send information back to Google Analytics - but we have one more variable to create.  We want to combine our Status and Percent into a single variable to send back in the Google Analytics Event field.  A table lookup variable comes to the rescue here:

GTM Video Tracking Status Variable

So you can see in this variable Video Status for GA we are returning the Video Percent value and adding the '%' symbol for 'progress' status.  IOtherwise we are returning the Video Status value.  If we are using Video Time Thresholds instead of Video Percent we would change this variable to return the Video Current Time (which is in seconds).

Now we can create our tag:

 GTM YouTube Video Tracking GA Event Tag

We are using a Google Analytics event tag to send back our YouTube tracking.  For our category we use 'video' so all our videos can be viewed in a single main category.  In your case you may want different categories - it will all depend on how you want to report your video view metrics.

Next we use our new 'Video Status for GA' variable for our Event Action.  And then for the Event Label field we send back the Video Title and Video URL.  (If you show the same video on different pages - you may want to include the Page URL in the Label field in place of the Video URL.)

A Preview of our GTM contain for a quick test should confirm that this works.

Read 7005 times Last modified on Tuesday, 16 March 2021 19:37
Jay Murphy

Jay Murphy is a digital analytics expert and founder of Trionia, where he specializes in transforming data into actionable insights for large and mid-sized businesses. With over thirty years of experience and a passion for Google Analytics since its inception, Jay has honed his skills to bridge the gap between technical data analysis and strategic business planning. An educator at heart, he has developed and taught comprehensive digital marketing courses at both the undergraduate level and within organizations, enriching minds with his deep understanding of the digital analytics landscape.

His career, which began in systems analysis for spacecraft guidance, has evolved through roles that blend technical acumen with strategic vision across various sectors, including Fortune 500, Higher Education and Non-Profits. Certified in Google Analytics since 2011, Jay's leadership at Trionia has spearheaded successful online campaigns and innovative marketing strategies, underlining his commitment to leveraging data for growth. Jay's approach goes beyond the numbers; he's a storyteller who uses data to drive business success, making him a pivotal figure in the digital marketing world.

Leave a comment

Make sure you enter all the required information, indicated by an asterisk (*). HTML code is not allowed.