Last Modified on October 23, 2024
So you want to learn how to track YouTube Videos?
This post shows how to track YouTube videos that you embed on your site or that you share as links elsewhere.
To track YouTube videos, you will either rely on Google’s Enhanced Measurement which automatically tracks video engagement, or configure the tracking via Google Tag Manager.
Although the former approach seems convenient, its caveats often leave GTM as the most preferred option.
We will cover how to quantify the consumption of YouTube video content on your website and measure the performance of YouTube as a traffic source.
The topics we’ll focus on:
- How to Track YouTube Videos in Google Analytics
- Naming Convention for YouTube Video Tracking
- How Do I Track a YouTube Link Click
- Google Analytics vs YouTube Analytics
Let’s dive in!
How to Track YouTube Videos in Google Analytics
There are 2 ways to track embedded YouTube videos in Google Analytics. We’ll cover them both with a focus on GA4.
- You can simply enable the Video engagement option within Enhanced Measurement (which automatically tracks video interactions without any code).
- You can configure your tracking in Google Tag Manager (recommended).
The first option is okay if you’re not using Google Tag Manager yet. It only requires a bit of clicking here and there.
However, for this to work, all your embedded videos must have the JS API support enabled which requires a modification of your YouTube embedded code.
Also, this first option will limit you to default thresholds (such as the video progress for any user viewing passed 10%, 25%, 50, and 75% of the video), which can get in the way of setting your thresholds.
Consequently, Google Tag Manager is the option of choice for many marketers. Using GTM is best practice, as you have more control over your data.
🚨 Note: We recommend using GTM. However, whichever option you choose, make sure not to use both at the same time. If you decide to use GTM, disable Video engagement in Enhanced Measurement to prevent duplicate data in your reports.
How to Track YouTube Videos in Google Analytics 4 with Enhanced Measurement?
This approach is suited for YouTube videos that are embedded on your website.
GA4 Enhanced Measurement allows tracking common events without the need for any code implementation. Unfortunately, it isn’t a magic wand for YouTube video tracking.
That is because you’ll need to add the enablejsapi parameter to the source URL of the video and set it to 1. This is how it looks exactly: enablejsapi=1.
Here are the steps to track videos with YouTube videos in GA4 with enhanced measurement:
1. Head to a YouTube video. Click Share.
2. Then select Embed.
3. Start by typing the question mark (?) at the end of the URL and then add the parameter to the code enablejsapi=1
4. Click copy, and embed this code on your website.
Ours looks as follows:
<iframe width="560" height="315" src="https://www.youtube.com/embed/Ly-IHQhX4DU?enablejsapi=1" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
How to Track YouTube Videos With Google Tag Manager
Let’s start by building a trigger in Google Tag Manager.
1. Go to Triggers and click New.
2. For the Trigger configuration, select the YouTube Video trigger type.
3. Follow our next setup.
There are occasions where video tracking may not work and one solution is to select Add JavaScript API support to all YouTube videos. So, we’ll keep it checked just in case.
This is a common setup that works for most people. But, it can be modified. At this moment, you’ll have to ask yourself or your team what you want to achieve with this trigger and what you want to measure.
- Are there specific pages or videos that you want to track?
If yes, then you can achieve it by selecting Some Videos for when the trigger should fire.
- Do you need to track the video progress in percentages or in time?
- Is capturing Pause, Seeking, and Buffering important to you?
Selecting this option will send an event each time a user clicks pause, seeks forward/back, or starts buffering.
Given the way we watch videos online, these events are likely to multiply very quickly and populate your GA4 unnecessarily. Therefore, If these events aren’t critical for your measurement, you can leave this option unchecked.
Now that you have a trigger, make sure that you’ve enabled the GTM’s built-in video variables. These will provide additional information about tracked videos.
4. Follow these steps: Variables → Configure
5. In Configure Built-In Variables, scroll down to Videos and select all the variables.
You can test your trigger quickly by enabling the preview mode in Google Tag Manager. We will use the welcome video embedded on our demo shop website.
1. Let’s preview the page by enabling the preview mode in your GTM Workspace.
2. In Tag Assistant, add your page URL.
3. Click Connect.
4. Play the video and skip to the end of the video, so we can see what data our trigger collects.
5. In the debug interface, you should see 2 events in the left panel entitled YouTube Video. The first one fired when the video started playing, and the second was when the video was completed.
6. You can verify these statuses by selecting one of the events under the Summary bar. Then click Variables.
7. Scroll down to Video Status and observe the value.
Let’s create a new Tag to send this information to Google Analytics.
Select Google Analytics: GA4 Event and use your GA4 settings variable for the Configuration Tag.
🚨 Note: If you’re not familiar with the process of creating GA4 events, check out our Google Analytics 4 tutorial for beginners. It’ll take you through setting up an account, how to use Google Tag Manager, and create events for GA4.
Let’s now name our tag.
Naming Convention for YouTube Video Tracking
You can name your event however you wish.
It is, however, best practice to first consider using existing event names either recommended by Google (called Recommended Events) or those listed in Enhanced Measurements before coming up with your own.
Let’s take a look at Enhanced measurement because there you’ll find more details on Video Engagement and Google’s event naming structure.
Google Analytics can natively track 3 different types of engagement:
- video_start
- video_progress
- video_complete
The good news is that Google Tag Manager has a variable known as Video Status, which you saw earlier. This variable shows these statuses depending on whether a user started, progressed, or completed a video.
So, instead of sending 3 events for each, your event will streamline all of them into one event with the current status of users.
This is how you do it. In your tag, in the Event name, type the word video followed by an underscore: video_
Google names all its events in lowercase and uses underscores to separate words. You should follow this convention.
Click the variable icon.
In Choose a variable, select the Video Status dataLayer variable.
Now your Event name will be the following: video_{{Video Status}}
You could consider the job done here.
However, we’d like to add more details to the event we’re sending to GA4. These details are called parameters.
What relevant details could you send to GA after users viewed a video? Again, we can get some inspiration from Google Analytics by looking at what parameters it tracks automatically with videos.
In the previous section, we looked at the Video Engagement section on the Enhanced measurement page. There you will not only see your option of video events but also the useful parameters that GA4 sends with it.
These are:
- video_current_time
- video_duration
- video_percent
- video_provider
- video_title
- video_url
- visible
We will use these to name our parameters. Choose those that will serve your measurement objectives. For our example, we will use all of them except for visible.
Copy and paste each into a separate row under Parameters.
Now we need to add their corresponding dynamic values.
Luckily for us, these values also exist as variables in Google Tag Manager. They’re the same video variables we enabled when creating our trigger.
To fetch them, click on the variable icon and select the matching variable for each. For example, to get the value for the video_current_time parameter, we will click the variable Icon.
Then select the Video Current Time dataLayer variable.
Repeat the process for each. You should end up with the following:
Name and save your tag.
Testing YouTube Video Tracking in Google Tag Manager
1. Click the Preview mode. Start and complete your video.
This is what you can expect if your tag is fired properly.
2. To make sure everything works well on GA4’s side, head over to the DebugView in GA4.
Here are the coming events.
3. To see the parameters we configured earlier, click on any of the events.
We will click on video_complete.
🚨 Note: All our parameters appear in the DebugView. However, to use them in your reports, you need to register them as custom dimensions.
Let’s look at an example of how to register our tag’s parameters as custom dimensions.
1. Copy a parameter. We will highlight and copy the Video title.
2. Staying on the same page, go to Custom definitions in Configuration and click Create custom dimensions.
3. In the Dimension name placeholder, write a relevant title. There is no naming convention here, so feel free to write your title any way you wish.Â
4. Select Event for Scope. The Description box is optional. The most important step is what you add in the Event parameter. Paste the parameter you copied earlier.
Here’s what everything should look like:
5. Click Save.
These parameters will be ready within the next 24 hours in your GA4 reports. By then, you’ll be able to use them in your reports and your Explorations.
How Do I Track a YouTube Link Click
Google Analytics can provide details on YouTube links shared anywhere online and that users click on. For this to work accurately, you’d need to use UTM tracking.
UTM tracking consists of tagging your links by adding code to the end of your URL.
By tagging your traffic sources, you can know where viewers came from (email, paid ads, podcast, group share, etc. ), how they navigate throughout your website, and how well they convert.
We designed a tool to help you tag your links fast with the support of our guide full of examples on how to use UTM tracking in the real world.
Lastly, you can evaluate your marketing efforts by determining how your YouTube channel compares to other traffic sources.
Google Analytics vs YouTube Analytics
We have often discussed the analytics features of Google Analytics for a good reason. It is the most popular analytics platform in the world.
However, YouTube is owned by Google, and it comes as no surprise that its analytics capabilities are powerful and quite similar to those of Google Analytics.
YouTube offers robust and detailed reports about the views, engagement, traffic sources, and demographics of visitors to your channel. You can view these reports within YouTube Analytics.
If you’re using YouTube as your main marketing channel, then its analytics are what you need to measure your success.
Now the question is – what’s the point of using Google Analytics to track YouTube videos?
There are a few reasons why you might want to use Google Analytics over YouTube’s native analytics. First, they are mostly all tied to understanding and measuring online behaviors outside of your YouTube channel.
Second, in today’s multi-touch marketing world, these reasons explain the need to have a global view of all your marketing efforts across different channels in one place for a global analysis.
This is not limited to Google Analytics, but also other platforms like BigQuery for example.
Google Analytics is a great option if you conduct a lot of your business through an online website because you likely don’t rely on YouTube as a primary marketing channel.
You might want to track and uncover insights unavailable in YouTube’s analytics dashboard, such as tracking visits to a blog post or another piece of content that lives on your site but isn’t a video.
If the goal is to understand how visitors coming from YouTube interact with your site, how engaged they are once there, and how they convert, then you want to look at Google Analytics via YouTube video tracking.
Google Analytics will help you also determine how YouTube as a channel holds up against other channels using attribution modeling.
FAQ
Can I use both Enhanced Measurement and Google Tag Manager for tracking YouTube videos simultaneously?
No, it is recommended to use either Enhanced Measurement or Google Tag Manager for tracking YouTube videos. Using both at the same time may result in duplicate data in your reports.
How can I track YouTube link clicks in Google Analytics?
To track YouTube link clicks, you can use UTM tracking by adding UTM parameters to the end of your URL. This allows you to track the traffic sources and behavior of viewers who click on your YouTube links.
What is the recommended naming convention for YouTube video tracking events in Google Analytics?
It is recommended to use existing event names recommended by Google or those listed in Enhanced Measurement. Event names should be lowercase with words separated by underscores.
Summary
The next time you have a YouTube video you want to track, you’ll know exactly what to do. You can always come back and refer to this post.
In the future, we’ll continue to post more ways to track other video-sharing platforms on your sites, so keep checking back.
Continue your learning journey and check out our handy guide on how to track site search in GA4.
The GTM bit to track YouTube videos based on your article is not working. I’ve tried to follow the instructions above.
Hello Priyanka, thanks for the comment. What part didn’t work exactly?
Hello,
Done: emails with link to company Youtube channel.
We want to track transitions via link from email to Youtube.
We added an UTM-tag for this link and, unfortunately, didn’t find it in Youtube Analytics.
Could you please share how we should track traffic from emails to Youtube channel?
Thank you.