Google Tag Manager Youtube Video Tracking via YouTube Video Trigger

Table of Contents for Google Tag Manager YouTube video tracking + Vimeo

  1. Introduction to Google Tag Manager YouTube video tracking
  2. Setting up video tracking via YouTube video trigger in Google Tag Manager
  3. Setting up Vimeo video tracking using Google Tag Manager
  4. FAQ

Today I am going to show you how to use the YouTube Video trigger in Google Tag Manager to track YouTube videos embedded on a webpage. We will also see how to track Vimeo videos.

Introduction to Google Tag Manager Youtube Video Tracking

The tracking method which is used to track/capture the various player states of an embedded video is called ‘video tracking’.

A player state is specific user interaction with a video.

Following are the example of various player states which can be captured for YouTube videos via GTM:

#1 Start – denotes video is playing.

#2 Pause – denotes video is paused.

#3 Seek – denotes scrub bar is moved to seek or reposition timing within a video.

#4 Buffering – denotes video buffering / downloading.

#5 Progress – denotes the progress of a specific video by percentage or time threshold. For example, if 5% of the total video length has been played then the value of Progress can be 5%. Similarly, if 10 seconds of video has been played then the value of Progress can be 10 seconds.

#6 Complete – denotes a video finished playing.

Get the E-Book (100 Pages)

 

Get the E-Book (62 Pages)

Setting up Video Tracking via YouTube Video Trigger In Google Tag Manager

Follow the steps below:

Step-1: Login to your Google Tag Manager (GTM) account and then click on the ‘Folders’ tab:

Step-2: Click on the ‘New Folder’ button.

Step-3: Name your new folder ‘YouTube Video Tracking’ and then click on the ‘create’ button. We are going to use this folder to store all tags, triggers and variables related to YouTube Video tracking.

Step-4: Click on the ‘Variables’ tab:

Step-5: Click on the ‘Configure’ button:

Step-6: Scroll down and then select all the built-in variables related to videos:

  1. Video Provider
  2. Video Status
  3. Video URL
  4. Video Title
  5. Video Duration
  6. Video Current Time
  7. Video Percent
  8. Video Visible

Step-7: Click on the ‘New’ button under the ‘User Defined Variables’ column:

Step-8: Create a new dataLayer variable with the following configuration and then move the variable to the folder named ‘YouTube Video Tracking’:

This dataLayer variable is used to pull the value of gtm.videoElapsedTime from the dataLayer.

The gtm.videoElapsedTime dataLayer variable reports on the time elapsed (in seconds) since the last time a video was paused or buffered.

Later when we create a new universal analytics tag to send video tracking data to GTM, we are going to call this dataLayer variable within the tag.

Step-9: Create a new lookup table variable (name it ‘Video Player State’) with the following configurations and then move the variable to the folder named ‘YouTube Video Tracking’:

I have created this variable to rewrite the outputs of the ‘video status’ variable. 

The ‘video status’ variable is a built-in GTM variable that returns the current video player state.

By re-writing the values of the current player state, I am making the video tracking report in Google Analytics more meaningful for the end-users (like my clients) who might not understand what ‘progress’ means or what ‘start’ stands for etc.

Step-10: Click on the ‘Triggers’ tab:

Step-11: Click on the ‘New’ button to create a new trigger.

Step-12: Name your new trigger as ‘YouTube Video Trigger’ and then move the trigger to the folder named ‘YouTube Video Tracking’ (by clicking on the folder icon next to the trigger name):

Step-13: Choose ‘YouTube Video’ as trigger type:

Your screen should now look like the one below:

Step-14: At this point, you need to decide your video tracking setup:

  • Whether or not you want to measure ‘Pause’, ‘Seeking’, ‘Buffering’ and/or ‘Progress’ Player states.
  • When the progress of videos should be measured?
  • How the progress of videos should be measured? In terms of percentages or time thresholds?
  • Whether or not you want to add JavaScript API support to all YouTube videos
  • What pages the ‘YouTube Video’ trigger should fire.

You can either decide your own video tracking setup or you can use the one I use:

Here, I am measuring all available player states of a YouTube Video.

The progress of my videos should be measured whenever a user passes the following percentage thresholds: 10,25,50,75,90

Add JavaScript API support to all YouTube videos. 

The YouTube Video Trigger will fire on all pages of my website.

Step-15: Click on the ‘Save’ button to complete the creation of the new trigger.

Step-16: Click on the ‘Tags’ tab:

Step-17: Click on the ‘New’ button to create a new tag.


Step-18: Name the new tag ‘Send YouTube Video Tracking data to GA’ and then move it to the folder named ‘YouTube Video Tracking’.

Step-19: Set up the new tag with the following configuration:

 

We are going to use this tag to send the video tracking data to Google Analytics.

Step-20: Set the firing trigger of the ‘Send YouTube Video Tracking data to GA tag to the ‘YouTube Video Trigger’ we created earlier:

Step-21: Click on the ‘Save’ button to complete the tag set up.

Step-22: Click on the ‘Preview’ button (on the top right-hand side) to preview and test your new video tracking setup:

It will open a new tab with a pop-up like below. Provide the URL where the YouTube video is present and click on ‘Connect’.

Step-23: It will open the provided URL in a new tab. Navigate back to the preview window and you should see the status as ‘Connected’. Now click on ‘Continue’.

You should see a ‘preview’ of events in the ‘Summary’ column available on the left-hand side.

Step-24: Now play, pause and/or seek the embedded YouTube video.

As you interact with the video player, you should see the new ‘YouTube Video’ event(s) being listed….one after the other under the ‘Summary’ column:

Step-25: Click on one of the ‘Youtube Video’ events and then click on the ‘Data Layer’ tab:

Step-26: Now look at the values of the following data layer variables:

 

gtm.video‘ is the name of the event that activates the YouTube Video trigger.

VideoProvider‘ variable returns the name of the video platform whose videos you are tracking. Its value is ‘youtube’.

VideoStatus‘ variable returns the current player state of a video. Its values can be: start, complete, pause, seek, buffering and progress.

VideoUrl‘ variable returns the URL of the embedded video.

VideoTitle‘ variable returns the the title of the embedded video.

VideoDuration‘ variable returns the total length of the embedded video in seconds.

VideoCurrentTime‘ variable returns the time (in seconds) where a user was when the last video event fired.

VideoElapsedTime‘ variable returns the time elapsed (in seconds) since the last time the video was paused or buffering.

VideoPercent‘ variable returns the percentage of the total video length where a user was when the last video event fired.

VideoVisible‘ variable returns either true or false, depending on whether or not the embedded video was visible in the viewport when the last video event fired.

If you see the values of the data layer variables then it means, YouTube video tracking is working correctly.

Step-27: Click on the ‘Submit’ button (on the top right-hand side):

Step-28: Enter your version name and then click on the ‘Publish’ button.

Step-29: Navigate back to the web page on your website which has got a YouTube video embedded on the page. Now play, pause and/or seek the embedded YouTube video.

Step-30: Wait for 10-15 minutes and then navigate to ‘Behavior’ > ‘Events’ > ‘Top Events’ report in your Google Analytics view:

Step-31: Find and click on ‘YouTube Videos Tracking’ event category:

In this event category you can find all of your video tracking data:

You can also track YouTube videos without using the YouTube video trigger.

To learn more about this tracking method, read this article: YouTube video tracking via Google Tag Manager

Setting up Vimeo video tracking using Google Tag Manager

If you are using Vimeo videos on your website, you can track those video events using Google Tag Manager.

The first step in tracking Vimeo videos is to integrate the Vimeo player with Google Tag Manager to receive the video events. The second step will be configuring Google Tag Manager to send events to Google Analytics.

Follow the below steps to learn more.

Step-1: Navigate to your Vimeo vide account settings and click on ‘Marketing’.

Step-2: Now scroll down to the bottom and you will see a tracking script under Google Analytics. Copy this script and keep it for further steps.

Step-3: Navigate to your Google Tag Manager account and click on ‘Tags’.

Step-4: Now click on ‘New’ to create a new tag, name it as ‘Vimeo Tracking Code’ and then click on ‘Tag Configuration’.

Step-5: Now select tag type as ‘Custom HTML’.

Step-6: Now paste the script that we copied earlier in the code window.

Step-7: Now click on ‘Triggering’ to create a trigger.

Step-8: Now click on the ‘+’ button to add a new trigger.

Step-9: Add you trigger a name ‘Video Vimeo Trigger- Dom Ready and select trigger type as ‘Page View – DOM Ready’.

Step-10: Select ‘All DOM Ready Events’ and then click on ‘Save’.

Step-11: You will be navigated to the Tag configuration window. Click on ‘Save’ again.

Step-12: Now we need to confirm if the Vimeo tracking script is loading or not. Click on the Google Tag Manager Preview button.

It will open a new tab with a pop-up like below. Provide the URL where the Vimeo video is present and click on ‘Connect’.

Step-13: It will open the provided URL in a new tab. Navigate back to the preview window and you should see the status as ‘Connected’. Now click on ‘Continue’.

You should see a ‘preview’ of events in the Summary column available on the left-hand side.

Step-14: Click on ‘Vimeo’ in the summary tab and then click on ‘Data Layer’.

Step-15: You should be able to see a ‘Vimeo’ event with the following details:

  • event: ‘vimeo’,
  • event_category: ‘Video’,
  • event_action: ‘load’,
  • event_label: ‘Sample Video | 253989945’ }

If you can see this message, you have successfully set up a Vimeo tracking script on your website.

Now before we start tracking Vimeo video events, we need to create three user-defined variables, a custom trigger, and a tag.

Step-16: Now navigate to the ‘Variables’ tab in the GTM console and click on ‘New’ under ‘User-Defined Variables’.

Step-17: Give the variable name as ‘Event Category’ and select variable type as ‘Data Layer Variable’.

Step-18: Now under ‘data Layer Variable Name’ type ‘event_category’ and then click on ‘Save’.

Step-19: Similarly, create the remaining two variables as per the below configuration:

Variable 2

  • Name: Event Action
  • Variable Type: Data Layer Variable
  • Data Layer Variable Name: ‘event_action’
  • Data Layer Version: Version 2

Variable 3

  • Name: Event Label
  • Variable Type: Data Layer Variable
  • Data Layer Variable Name: ‘event_label’
  • Data Layer Version: Version 2

Step-20: Now let’s create a trigger for Vimeo events. Navigate to ‘Triggers’ in Google Tag Manager and click on ‘New’.

Step-21: Give a name to your trigger, such as ‘Vimeo Events’, and then select the trigger type as ‘Custom event’.

Step-22: Now under ‘Event Name’ type ‘vimeo’ and then click on ‘Save’.

The following event actions are sent from the player and will be tracked:

  1. load
  2. play
  3. progress – 25%
  4. progress – 50%
  5. progress – 75%
  6. progress – 100%
  7. emailcapture

If you want to track only a few of the above events, you can request it to fire on some events only, by specifying the required events in the trigger condition.

Step-23: Now navigate to the ‘Tags’ tab in Google Tag Manager and click on ‘New’.

Step-24: Give your tag the name ‘Vimeo Video Events’ and select the tag type as ‘Google Analytics- Universal Analytics’ and track type as ‘Event’.

Step-25: Now under ‘Event Tracking Parameter’, you need to link the data layer variables created earlier like below

  • Category: Event Category
  • Action: Event Action
  • Label: Event Label

Step-26: Select your Google Analytics tracking Variable in ‘Google Analytics Setting’ and then click on ‘Triggering’.

Step-27: Now select the custom event trigger that we created earlier ‘Vimeo Events’.

Step-28: Now click on ‘Save’ to save the tag configuration.

Step-29: Now let’s debug and validate the Vimeo video events using Google Tag Manager preview mode. Click on the ‘Preview’ button (on the top right-hand side) to preview and test your new Vimeo video tracking setup:

It will open a new tab with a pop-up like below. Provide the URL where the Vimeo video is present and click on ‘Connect’.

Step-23: It will open the provided URL in a new tab. Navigate back to the preview window and you should see the status as ‘Connected’. Now click on ‘Continue’.

You should see a ‘preview’ of events in the ‘Summary’ column available on the left-hand side.

Step-24: Now play, pause and/or seek the embedded Vimeo video.

As you interact with the video player, you should see the new ‘Vimeo’ event(s) being listed….one after the other under the ‘Summary’ column:

Step-25: Now click on an of the event and then click on ‘Data Layer’. You can also see that the ‘Vimeo Video Events’ tag is fired.

Once you click on Data Layer you should be able to see event details, as below:

Congratulations!!! You have successfully set up Vimeo Video Events.

Now navigate to Google Analytics console and under ‘Real-time > Events’ you should be able to see data flowing in Google Analytics.

 

Other articles on specialized tracking in Google Analytics

  1. Google Analytics Ecommerce Tracking Tutorial
  2. Google Tag Manager Event Tracking Tutorial
  3. Google Analytics Event Tracking Tutorial
  4. Google Analytics Store Visits Tracking Tutorial
  5. Offline Conversion Tracking in Google Analytics – Tutorial
  6. Ecommerce Tracking Google Tag Manager (GTM) – Tutorial
  7. Tracking Virtual Pageviews in Google Tag Manager – Tutorial
  8. Google Tag Manager YouTube Video Tracking
  9. How to unlock not provided keywords in Google Analytics?
  10. Google Analytics Virtual Pageviews Tutorial
  11. Google Analytics and YouTube Integration Tutorial
  12. Google Analytics for Facebook Tutorial
  13. Cross Domain Tracking in Google Analytics – Complete Guide
  14. How to use two Google Analytics codes on one page
  15. The one thing that you don’t know about PayPal.com and the referral exclusion list
  16. Google Analytics Calculated Metrics – Tutorial
  17. Creating your own Google Analytics Tag Auditing System
  18. Google Tag Manager Search Tracking without Query Parameter
  19. Tracking Google Analytics Paypal Referral and other payment gateways
  20. How to Track Phone Calls in Google Analytics – Call Tracking Tutorial
  21. How to track leads in Google Analytics via CRM
  22. Postbacks in Google Analytics Explained
  23. Subscription & Recurring Revenue Analytics in Google Analytics
  24. Track the Impact of Google Analytics Cookie Consent on Website Traffic
  25. Tracking Offline Conversions in Google Ads
  26. Implementing Scroll Tracking via Google Tag Manager
  27. Scroll Depth Tracking in Google Tag Manager – Tutorial
  28. Site Search Tracking In Google Analytics Without Query Parameters
  29. How to Correctly Measure Conversion Date & Time in Google Analytics
  30. Google Analytics Social Tracking – Twitter, Facebook, Google Plus and LinkedIn
  31. Cross Domain Tracking in Google Analytics – Complete Guide
  32. Google Analytics Linkedin & Twitter Tracking
  33. Creating Content Group in Google Analytics via tracking code using gtag.js
  34. Google Analytics Site Search Tracking via Query Parameters
  35. Google Analytics Site Search Tracking Tutorial
  36. Creating and Using Site Search Funnel in Google Analytics
  37. Learn to Setup Facebook Pixel Tracking via Google Tag Manager
  38. AMP Google Analytics Tracking – Learn to track AMP pages
  39. Setting up Sales Funnel across websites in Google Analytics
  40. Regex Google Analytics & Google Tag Manager – Tutorial

Frequently Asked Questions About Google Tag Manager YouTube video tracking + Vimeo

How do you track YouTube videos using Google Tag Manager?

To track YouTube videos using Google Tag Manager you need to follow the below steps:
1. Enable Built-in Variables for YouTube Video in GTM
2. Create a user-defined data layer variable “Video Elapsed Time” with variable name as “videoElapsedTime”.
3. Create a new lookup table variable and specify the event’s output
4. Create a YouTube Trigger and specify the event you would like to track (start, complete, pause, seeking, buffering, and progress)
5. Create a YouTube Tag for Google Analytics
6. Test the Tag using the preview mode.

How many YouTube events can be tracked in Google Analytics?

You can track the following YouTube video events in Google Analytics.
– Start – denotes video is playing.
– Pause – denotes video is paused.
– Seek – denotes scrub bar is moved to seek or reposition timing within a video.
– Buffering – denotes video buffering / downloading.
– Progress – denotes the progress of a specific video by percentage or time threshold. For example, if 5% of the total video length has been played then the value of Progress can be 5%. Similarly, if 10 seconds of video has been played then the value of Progress can be 10 seconds.
– Complete – denotes a video finished playing

What is the similarities and difference in YouTube video and Vimeo Video?

Below points provides you overall similarities and difference in YouTube video and Vimeo video.
Video Viewing: Both video platform provides video viewing facility.
– Video Uploading: Both platforms provides you with the facility to upload videos.
– File Size: In YouTube, you can upload videos up to 20 GB (free) and in the case of Vimeo, you can upload only up to 500 MB (free). After 500 MB of space Vimeo is chargeable.
– Video Quality: With YouTube, you can use video quality as HD up to 1080p, HDR, 4K, 8K. while in Vimeo you can use HD quality video up to 720 pixels

Register for the FREE TRAINING...

"How to use Digital Analytics to generate floods of new Sales and Customers without spending years figuring everything out on your own."



Here’s what we’re going to cover in this training…

#1 Why digital analytics is the key to online business success.

​#2 The number 1 reason why most marketers are not able to scale their advertising and maximize sales.

#3 Why Google and Facebook ads don’t work for most businesses & how to make them work.

#4 ​Why you won’t get any competitive advantage in the marketplace just by knowing Google Analytics.

#5 The number 1 reason why conversion optimization is not working for your business.

#6 How to advertise on any marketing platform for FREE with an unlimited budget.

​#7 How to learn and master digital analytics and conversion optimization in record time.



   

My best selling books on Digital Analytics and Conversion Optimization

Maths and Stats for Web Analytics and Conversion Optimization
This expert guide will teach you how to leverage the knowledge of maths and statistics in order to accurately interpret data and take actions, which can quickly improve the bottom-line of your online business.

Master the Essentials of Email Marketing Analytics
This book focuses solely on the ‘analytics’ that power your email marketing optimization program and will help you dramatically reduce your cost per acquisition and increase marketing ROI by tracking the performance of the various KPIs and metrics used for email marketing.

Attribution Modelling in Google Analytics and Beyond
Attribution modelling is the process of determining the most effective marketing channels for investment. This book has been written to help you implement attribution modelling. It will teach you how to leverage the knowledge of attribution modelling in order to allocate marketing budget and understand buying behaviour.

Attribution Modelling in Google Ads and Facebook
This book has been written to help you implement attribution modelling in Google Ads (Google AdWords) and Facebook. It will teach you, how to leverage the knowledge of attribution modelling in order to understand the customer purchasing journey and determine the most effective marketing channels for investment.

About the Author

Himanshu Sharma

  • Founder, OptimizeSmart.com
  • Over 15 years of experience in digital analytics and marketing
  • Author of four best-selling books on digital analytics and conversion optimization
  • Nominated for Digital Analytics Association Awards for Excellence
  • Runs one of the most popular blogs in the world on digital analytics
  • Consultant to countless small and big businesses over the decade
error: Alert: Content is protected !!