Tracking Embedded YouTube Videos with Google Tag Manager

Wish you could see better data about how users engage with embedded YouTube videos on your website? Sure, Google Analytics will show you how many people visited the page containing your video, but by default you won’t see performance for the video itself without heading over to YouTube Analytics. Thankfully, Google Tag Manager offers built-in triggers allowing you to track performance on a granular level, without having to write a line of code.

In this article, we’ll walk through setting up tracking for embedded YouTube videos using Google Tag Manager (GTM), as well as how to view the resulting data in Google Analytics. If you haven’t yet set up GTM on your site, walk through Google’s Quick Start Guide.

Setting Up a YouTube Trigger

To start, navigate to your desired GTM container and go to Triggers from the lefthand menu. Click “New” to begin creating the trigger.

Now, click within the “Tag Configuration” box to choose your tag type. Select “YouTube Video” from the list.

Next, you’ll see a list of options for what you’d like to track with the trigger. Check the boxes for what you’d like to include in Analytics.

  • Start tracks an event each time a user begins watching a video
  • Complete tracks an event each time a user reaches the end of the video
  • Pause, Seeking, and Buffering tracks an event when a user takes any of those actions
  • Progress allows you to mark events based on how far a user watches a video.
    • If you choose Percentages, enter numbers separated by commas for which percentage points you’d like to track. For instance, the given example will register an event at 10%, 25%, 50%, 75%, and 90%.
    • If you choose Time Thresholds, your numbers will reflect seconds watched.

For general use, you can likely ignore the JavaScript API checkbox. Finally, you can select which videos the trigger will fire on. If you want it to fire for every video across the entire site, choose “All Videos.”

To fire only for specific videos, choose “Some Videos.” Now, you can define parameters for when the trigger will fire. You can choose from a number of preset variables, including page-specific criteria or video-specific criteria like video title or duration watched.

In this example, we’ve chosen to only fire the trigger for videos on an About page URL. After entering the URL path, we’ll save the trigger.

Setting Up the Google Analytics Tag

Next, you’ll need to set up a tag to send events to your Google Analytics account. First, you’ll need to make sure you’ve activated the video-related variables.

Go to Variables from the lefthand menu and click “Configure.” In the list that appears, scroll to the Video category and check the boxes next to each contained element to enable for use in tags.

Now, navigate to the Tags section and create a new tag. Choose Google Analytics as the Tag Type. Then, select Event from the Track Type menu.

Now, you can set up the tag to show the event parameters you’d like to populate in Google Analytics. This may depend on your specific use case; you can select the “brick” icon at the right of any field to add in variables.

For instance, this example will automatically populate the video status and percentage watched in the Action field, and the video title and URL in the Label field. See Simo Ahava’s blog post for a more detailed solution that allows you to auto-populate the video action (play, pause, percentage watched, etc.) using a Javascript variable.

Next, click within the Triggering field to add a trigger. Select your previously created YouTube trigger here. Save your tag, and be sure to publish your changes live for them to take effect (or test in GTM preview mode).

Viewing Data in Google Analytics

Once you’ve set up the trigger and allowed some time for data to accrue, you should then see video-related events appearing in Google Analytics. In your Analytics account, navigate to Behavior > Events > Top Events from the lefthand menu.

Now, you should see a “YouTube” event category (or whatever you named the Category field in GTM) appearing if events have been tracked. Click this to see more detail.

The specifics will depend on how you defined the fields. In this case, we’re viewing actions such as video starts and percentage watched, along with the video title and URL in the label field.

Start Tracking!

If you haven’t yet set up the YouTube trigger to get better data on your embedded videos, dive into GTM and get started! It’s relatively simple to set up and will reward you with better data showing which videos your website visitors engage with the most and where they’re dropping off in video views.

Do you have any further tips for customizing the YouTube video trigger? Share in the comments below!

To learn more, see our BIG List of Google Tag Manager Guides & Resources.