Do you embed YouTube videos in your web pages and then wonder if people are interacting with these videos or not? If the answer is yes, then continue reading this chapter.
Google Tag Manager provides inbuilt variables and triggers to make it easy for you to track YouTube Videos.
Configuring the Variables
There are built-in variables that Google Tag Manager provides for us to track these videos.
Click variables and Configure the “Built-in Variable” section. Scroll down, and then you have all the video tracking variables.
Most of these variables are self-explanatory, so I will not define each of them. The ones that we will use are
Video Provide: Name of the video provider in our case it will be YouTube
Video Current Time: An integer that represents the time in seconds at which an event occurred in the video.
Video Status: Tracks the status of video such as Start, Pause
Video Percent – An integer representing the percentage of video played at which an event occurred.
Be sure to enable all the variables so if you decide to use them in your tags or triggers, they will be available to you. Now we are ready to create our tag and trigger.
Configuring the Trigger
Create a new trigger of type YouTube Video.
Once you do that, you will get several options to pick the status of the videos you want to track. Configure them as shown below
Figure: YouTube Video Tracking
In the above configuration, we are tracking all the status options and then tracking the progress as a percentage. You can also pick the time threshold if you wish. The percentage will track the percentage of the video that a user has looked at, such as 10%, 25%, etc. Time Threshold measures the actual time such as 10 sec, 25 seconds, etc.
In the above configuration, we are going to track 10, 25, 50, 75 and 100 percent.
Then another option is to add JavaScript API support to all YouTube videos.
Some of the videos on YouTube are not going to be tracked by default due to their setting, and in order to track all the videos, you have to select this option.
And finally, you can specify if you want to do it to all videos or some specific ones. We're just going to continue with all videos. Once done, save the trigger. Now, let’s add a Tag.
Configuring the Tag
We will send this information to Google Analytics as an event tag. The configuration will be as shown below
Category: Video Provider Variable
Action: Video title variable
Label: Video Status Variable - Video Percent Variable and -Video Current Time variable
It's a non-interaction hit.
Assign your Google Analytics property id variable and save it.
Figure: YouTube Video as Event
Save the tag, preview it and publish it.
Your report in Google Analytics will now start to show the Video engagement data.
Want to Learn Google Tag Manager. Here are few options: