Google Tag Manager

How to Track YouTube Embeds Play/Pause Via Google Tag Manager

Have you ever wondered how many users watch an embedded YouTube video on your website or blog? In this article, I will share how to track embedded youtube videos play/pause on your website or blog via Google tag manager.

So, let’s begin with setting up YouTube video tracking using Google tag manager.

Step 0: Pre-requisites

You should be aware of Google Tag Manager Lingo. Moreover understand what a trigger, tag, and the built-in variables available are.

The next is, you should have a Google Tag Manager for tracking site’s traffic in Google Analytics though it isn’t a must. We will still need to have the Google Analytics Property ID to send scroll depth data to Google Analytics.

If you aren’t sure, refer to my article – How to Connect Google Analytics With Google Tag Manager first and then continue with this article.

Next, we need to create a user-defined variable. Just follow the below steps with appropriate configurations, and you will be all fine with it.

Step 1: Define Video Elapsed Time Variable

Create a new variable “Data Layer” as (Video Elapsed Time) Variables > User-Defined Variables > New

YouTube provides the amount of time video is played into the gtm.videoElapsedTime. We take that value and define a Data Layer Variable to be able to use in GTM Tag.

Step 1: Create Trigger

  • Trigger name: You can name the trigger that is identifiable to you. I have it as “YouTube Video Trigger”.
  • Trigger type: Select YouTube Video from the built-in trigger type list.
  • Capture: Tick all the checkboxes to record the data from start to complete.
  • Trigger fires on: All videos across the site, but you can define based on page URLs or video embed ids.

Step 2: Create a Tag

  • Tag name: Any name that helps you identify the tag. I have named it “YouTube Video Tracking”.
  • Tag type: Google Analytics – Universal Analytics
  • Track type: Event (Select from the built-in list)

Event Tracking Parameters

  • Category: YouTube Video Tracking
  • Action: {{Video Title}}
  • Label: {{Video Player State}} – {{Video URL}}
  • Value: {{Video Elapsed Time}}
  • Non-Interaction hit: False (Only if you want to make this tag reduce bounce rate, else set as true)
  • Google analytics settings: {{Google Analytics ID}}

Track Your Tag in Google Analytics

Log in to your Google Analytics account and locate the Affiliate Link Clicks event under Behavior > Events > Overview. Look for the category that we assigned in step 2 which is YouTube Video Tracking

Under Actions, it will show Video title and URL.

And under Event Label, it will show the “Video Status” of being played and paused.

Check out affiliate link clicks, external link clicks, page scroll depth and Google ads conversion using the Google tag manager.

Shabbir Bhimani

Blogging Since 2009. If I can leave my high paying C# job in an MNC in the midst of global financial crisis of 2008, anybody can do it. @BizTips I guide programmers and developers to Start and Grow an Online Business. Read more about me here.

Recent Posts

Absolute Beginners Guide to Google Ads

Free Google Ads Tutorial for an absolute beginner covering campaigns and their types, networks, keywords,…

2 years ago

How Freshers Can Make Money Programming in Java

Do you want to make money programming in Java? Here are 6 creative ways for…

3 years ago

Financial Freedom for Freelancers – 9 Smart Ways

9 smart ways for freelancers to achieve financial freedom. First, you have to believe it…

3 years ago

How To Become A Self-Taught Developer

With so many programming languages and resources available, it can be information overall to learn…

3 years ago

Wise Review – Best Exchange Rates For Indian Freelancers

Wise review from an Indian freelancers point of view to receive payments in India. How…

3 years ago

How to Tell a Client you Can’t Lower the Price?

There are 3 types of clients who want you to lower the price. How to…

3 years ago