Chapter 07

YouTube video tracking tag

By Anna Tomalik

In this chapter, we’ll show you how to set up a handy tag for collecting data from YouTube videos embedded on your site or app. The collected data will include plays, rewinds, pauses, mutes, watch time, progress and more. 

To set up a YouTube video tracking tag, follow these steps:

  1. Go to Menu > Tag Manager.
  2. Navigate to Tags.
  3. Click Add a tag.
  4. Name the tag and select the following type: YouTube video tracking.
  5. Click Next.
  6. (Optional) Turn on Track progress and set up percentages.
    YouTube video tracking tag
  7. In Advanced tag settings, choose Consent type. Set it up if you use a consent form on your site. This tag will fire only for visitors who accept the selected consent type.
  8. Respect opt-out and DNT is turned on by default. Leave it as is if you want to respect visitors who’ve turned on the Do-Not-Track feature in their browsers or who’ve opted out of tracking using our opt-out form.
  9. In Flight dates, set the date and time when the tag is fired.
  10. In Tag triggers, click Choose existing trigger.
  11. Choose the following trigger: All page views.

    Note: You can also set a new trigger that will fire this tag on selected pages.

  12. When you’re done, click Save for the trigger.
  13. Click Save for the tag.
  14. Click Debug and check if your tag is fired correctly.
    Debug mode in Piwik PRO

    Note: The YouTube video tracking tag runs a complex script that collects various pieces of video data and sends them to Analytics. You just need to make sure that the tag fires on the pages with videos. The script will take care of everything else.

  15. When you’re happy with how the tag works, click Publish.
  16. You can quickly check if data is collected correctly by going to Menu > Analytics > Settings > Tracker debugger.
    Tracker debugger in Piwik PRO

    Note: Data in the tracker debugger appears instantly. Data in reports appears in about 30 minutes.

  17. After data is collected, you’ll see it under Menu > Analytics > Reports > Video analytics.
    Video report in Piwik PRO

Note: For HTML5 videos use our dedicated HTML5 video tracking tag. For Vimeo videos, use a dedicated custom code.