How to Track Local and Dynamically Loaded YouTube Videos Using Google Tag Manager

Recently we looked into improving the tracking of our videos making our statistical data more detailed and informative. We wanted to see the complete picture:

  • The number of views for both local and dynamically loaded YouTube videos.
  • Viewer’s behavior: Do they watch the video till the end or stop it just after the beginning?
  • What percentage of the video is actually being watched: 10%, 25%, 75%?

The problem we faced was the limited amount of resources for video-centric solutions. Among the available data many of the implementations were outdated and did not cover key parameters such as custom metrics or calculated metrics.

We searched all over the web, and finally decided to come up with a solution by ourselves. We have discovered a great tool to track videos - Google Tag Manager (GTM) in tandem with Google Analytics.

But as far as dynamically loaded YouTube videos are concerned, no relevant information was available.

That’s why we wrote a unique script which helped us to properly adjust the tracking of local videos and dynamically loaded YouTube videos. We will gladly share this experience with you so you can reap the benefits of it.

But let’s start from the beginning and find out what are local videos and dynamically loaded YouTube videos, and why is it so important to track them?

Almost every business with an Internet presence implements videos for their websites as part of their Internet Marketing strategy. Videos are very descriptive, and within 3-5 minutes of a promotional video customers can learn more about you than from a few pages of text.

We’re sure that your business likewise uses videos as well. You spend a lot of time and money to produce them, so wouldn’t you like to know if people are even watching your videos? What parts do they skip over and which ones are the most popular? Such statistics will help you understand what products you should promote and which ones to shelve or improve. Proper video tracking and advanced statistics will help you save a lot of money. You’ll avoid redundant spending and be able to concentrate more on the material that viewers are interested in.

Two types of videos

There are two types of embedded video on web-pages. The first type is static video embedded into a page and hosted on the local server. For example, videos that are embedded into landing pages using a HTML5 Video Player.

The second kind is a dynamically loaded YouTube video, hosted on the YouTube server. When visitors watch dynamic videos on your website, they watch them directly from YouTube. But how can you track these views? And how do you track local video views?

There are certain algorithms applied to track either one of these types. We provide a detailed guidance on how to track both of these types of videos and the unique scripts to implement proper tracking. Using our tutorial, you will learn how to adjust Google Tag Manager and connect it to Google Analytics to see your visitors behavior.

Please follow this link to view and use our guide on how to track local and dynamically loaded YouTube videos using Google Tag Manager. To download a unique script from the guide, please follow this link.


Reporting tools are very important to indicate whether your website is performing well or not. When you are aware of the strengths and weaknesses of your site, you know where to invest your money. With properly adjusted video tracking you’ll have a better idea of how users are interacting with your content, and consequently you’ll know how to interact with them.

Phone Consultation Phone Consultation

Free 30 minute technical consultation

Your message has been received.
An engaged representative will contact you shortly.
Thank you.