Tracking YouTube Video Average Watch Time in Google Analytics

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+00:00September 18th, 2018|4 Comments

4 Comments

  1. Nishant October 10, 2018 at 5:51 am - 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 October 10, 2018 at 12:40 pm - 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 October 11, 2018 at 3:31 am - 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

Leave A Comment