Tracking YouTube Video Average Watch Time in Google Analytics

  • video on website

Tracking YouTube Video Average Watch Time in Google Analytics

With millions of videos uploaded to YouTube, chances are you have embedded videos on your website. Whether it be a how-to tutorial, a company introduction, or a funny cat clip, you likely want to know how these videos are performing. While engagement metrics are available in YouTube Analytics, metrics such as average video watch time or the video completion ratio are not available in out-of-the-box Google Analytics tracking. Adding these additional metrics will allow you to gain a better understanding of how long people are watching your videos, and enable you to segment Google Analytics users based on video-related behaviours.

If you’re already using Google Tag Manager, setting up tracking Google Analytics for YouTube videos is fairly straightforward. By following these steps to configure Google Analytics and Google Tag Manager, you will be able to create reports and dashboards to monitor the engagement of the videos on your site.

Google Analytics Configuration

1. Create Custom Dimensions and Metrics in Google Analytics

In your Google Analytics account, create the following custom dimensions and custom metrics under Admin > Property > Custom Definitions. Note you will need to specify the scope for both, and formatting type for the custom metrics. The indices will be automatically assigned based on the next available slot:

  1. Custom Dimensions
  2. Custom Metrics

2. Create Calculated Metrics in Google Analytics

The Video Percentage Watched and Video Time Watched custom metrics created in Step 1 are useless for aggregate reporting without calculating the averages. In Google Analytics, create the following calculated metrics under Admin > View > Calculated Metrics:

  1. Avg. Video Percent Watched
    • Set the Formatting Type as Percent, and include the formula: {{Video  Percentage Watched}} / {{Video Starts}} / 100
  2. Avg. Video Time Watched
    • Set the Formatting Type as Time, and include the formula: {{Video Time Watched}} / {{Video Starts}}
  3. Video Completion Ratio
    • Set the Formatting Type as Float, and include the formula: {{Video Completes}} / {{Video Starts}}

Configuring these calculated metrics will allow you to build custom reports or dashboards focused around the performance of videos such as. For example, you could create a custom report to see the average video watch time for each specific video on your site.

Google Tag Manager Configuration

3. Enable Built-In Video Variables in GTM

Google Tag Manager has several built in variables for YouTube videos. Under the Variables section in GTM, select Configure, and enable the following built-in variables under the Videos section:

4. Create Triggers in GTM

Next, create three separate YouTube Video triggers for Start, Progress, and Complete:

  1.  Under the triggers section, add a new trigger for Video Starts > select the built-in trigger type YouTube Video > check off the capture type Start, and save:
  2. Add a new trigger for Video Progress. Enter the percentage thresholds 20, 40, 60, 80:

    • Note there is no need to track 100% progress, as this will be captured in the Video Completes trigger.
  3. Add a new trigger for Video Completes:

5. Create Tags in GTM

Under the Tags section in GTM, configure three separate tags for Start, Progress, and Complete. For each tag, you will use the corresponding trigger created in Step 4.

  1. Create a Video Start tag:
    • Create a new Universal Analytics tag. Set the Track Type as Event:
    • Enter the Event Tracking Parameters as specified below:

      • Check Enable overriding settings in this tag to add custom dimensions and metrics specific to this tag. Recall from Step 1 that we created the custom dimensions and metrics in Google Analytics.
    • Under More Settings > Custom Dimensions and Custom Metrics, add the following:

      • Note that the Index numbers entered must correspond with the Custom Dimension and Custom Metrics Indicies defined in Google Analytics (Step 1).
      • The custom metric above (Index 3) corresponds with the Video Starts metric in Google Analytics, and will increment by 1 every time a video is started.
    • Under the trigger section, add the YouTube Video – Start trigger created in Step 2:
  2. Create a Video Progress tag:
    • Create a new Universal Analytics tag and set the Track Type as Event.
    • Fill in the Event Tracking Parameters as specified below, ensuring to check Enable overriding settings in this tag:
    • Under More Settings > Custom Dimensions and Custom Metrics, enter the following:

      • The first custom metric above (Index 1) corresponds with the Video Percentage Watched custom metric in Google Analytics. Each time this event tag fires (i.e. at 20, 40, 60 and 80 percent watched), the value 20 will be sent to Google Analytics. Though the custom metric is not useful by itself, it allows us to calculate the Avg. Video Percentage Watched (the calculated metric created in Step 2).
      • For the second custom metric above (Index 2), you will need to create a new variable that will be used to convert the percentage thresholds into time units (seconds, minutes). By doing so, the Video Time Watched will be tracked in Google Analytics, and allow us to calculate the Avg. Video Time Watched (the calculated metric created in Step 2).
    • Follow the steps below to create the new {{Video Progress Interval}} variable:
      • Click the plus icon  beside the metric value.
      • Click the + icon beside ‘Built-ins’: 
      • Name the new variable Video Progress Interval.
      • Click on Variable Configuration and select the Custom JavaScript variable type.
      • Enter the following JavaScript function:
        function() {
        return Math.round(0.20*{{Video Duration}});
        }
        • The Math.round expression will ensure that the video time watched will be an integer (e.g. 52.2 seconds will be rounded to 52 seconds) since custom metrics must be integers.
        • The 0.20*{{Video Duration}} expression is the time measure of our percentage threshold. The Video Duration variable populates with the full duration of the video. We are taking 20% of this value, as the percentage thresholds applied to the Video Progress trigger have equal increments of 20.
    • Add the corresponding YouTube Video – Progress trigger created in Step 2:
  3. Create a Video Complete tag:
    • Create a new Universal Analytics tag and set the Track Type as Event.
    • Fill in the Event Tracking Parameters as specified below, ensuring to check Enable overriding settings in this tag:
    • Under More Settings > Custom Dimensions and Custom Metrics, add the following:

      • We have added custom metric 1 and 2 on this tag to account for the last 20% threshold that is not included in the Video Progress tag. If you recall from Step 4ii, the Video Progress tag does not fire at 100%.
      • The third custom metric above (Index 4) corresponds with the Video Completes metric in Google Analytics, and will increment by 1 every time a video is completed.
    • Add the corresponding YouTube Video – Complete trigger created in Step 2:

Putting It All Together

6. Create a Custom Report in Google Analytics

Once you have tested and published your changes in Google Tag Manager, you will now see data in Google Analytics, which will allow you to create a custom report to dive deeper into your video data:

Have any questions? Let us know in the comments below or reach out to us. ClickInsight is a Google Marketing Platform Partner with product certifications in Google Analytics, Tag Manager, Data Studio, and Optimize.

 

By |2018-09-18T14:25:58-04:00September 18, 2018|10 Comments

10 Comments

  1. Nishant 2018-10-10 at 05:51 - Reply

    HI Marc,

    Tried incorporating GTM codes for one of my website & there are no sessions or there is no time recorded for the videos. Is there a way, you guys could help me with this.

    All help is highly appreciated.

    • Marc Soares 2018-10-10 at 12:40 - Reply

      Hi Nishant,

      Assuming that you have followed the steps in the blog post correctly, but are still not seeing data in Google Analytics, it’s possible that the built-in YouTube triggers don’t work for your particular video implementation. In this case, you may have to write your own video listener script. This is beyond the scope of what we can cover via our blog.

      Before going any further, I would suggest going back through your implementation and ensuring that it matches the setup we’ve described above.

      Marc

      • Nishant 2018-10-11 at 03:31 - Reply

        Hey Marc,

        Appreciate your efforts in responding to my queries. Would like to clarify certain concerns from my end. These videos are normal You Tube videos embedded on our website. Have checked multiple videos with multiple pages & none gets tracked. Have verified that all the steps listed in the tutorial are implemented properly.

        Any help in resolving the highlighted issue would be much appreciated.

        Regards

  2. Glenn 2019-07-24 at 09:15 - Reply

    Great topic and explanation, but i got a weird result when i tried this, one of my vids showed an AAvg Video Percent Watched rate of 130%.

    There were 2 starts and 2 completes for this vid, so expecting to see a 100% watched rate.

    Is there anything you can think of which might explain this?

    — Glenn

    • Marc Soares 2019-07-25 at 09:36 - Reply

      Hi Glenn,

      Thanks for the comment. The Avg. Video Percent Watched calculation is determined by the Video Percentage Watched and Video Starts custom metrics. Did you use the same percentage thresholds as shown above (20,40,60,80)?

      Marc

      • Glenn 2019-07-25 at 22:01 - Reply

        Yes, I did. I’ve gone back through the set-up, and can see no errors.

        I just did a test, starting a video and skipping ahead to near the end, which yielded 1 video start event, one 80% watched event, but no 20%, 40% or 60% watched events. I’m going to work through the calculation (when back in the office on Monday) to see if this might explain the anomalous result i saw (based on a few test views).

        — Glenn

      • Glenn 2019-07-28 at 09:00 - Reply

        Hi Marc, the web developer moved the video in question to another page, and it now has a new ID, so that odd result i got (> 100%avg percent watched) is frozen.

        Maybe there is something in the calculation that would produce such a result if the video was started, then skipped forward to near the end (80% watched or something like that)? If i get some time next week i’m going to try to understand how the calculation is made, to identify what conditions will produce such odd results.

        With numerous tests on several videos, the stats appear to reflect actual viewing behavior.

        Thanks again for sharing your knowledge.

        — Glenn

  3. Jefrey 2020-12-23 at 23:59 - Reply

    Hey Marc! Hope that you see this!
    I’ve did what you showed here in the blog and I’ve successfully retrieve the event data in my GA.

    I created the custom report but the custom report isn’t showing any data here.
    Does GA takes some time to populate the data into custom report?

    -Jeffrey

    • Marc Soares 2021-01-05 at 11:55 - Reply

      Hi Jeffrey,

      Custom reports in GA are subject to the standard processing lag. You should wait until the next day for data to be available in standard reports and custom reports.

      Marc

Leave A Comment