Don't have one? Create one ↗
← All courses

Lesson 6 of 7

YouTube Video

① Connect your GTM container

Paste your container ID to load it into this page. It only ever runs here.

Advanced: use a specific environment

Most embeds need a custom listener before GTM can hear them. YouTube is the happy exception: it has a built-in trigger. Enable it and GTM injects the YouTube IFrame API for you and starts pushing gtm.video events, start, progress and complete, with no code of your own.

The matching Video built-in variables (status, title, percent, current time) carry the detail, so a single tag can report "watched 75% of Intro to GTM". You choose which milestones matter by setting progress thresholds on the trigger.

Goal

Enable the YouTube Video trigger, capture Start / Progress / Complete, and read the Video built-ins.

Build it in GTM

  1. Turn on the Video built-in variables

    Variables → Configure, enable the Video group: Video Status, Video Title, Video Percent, Video Provider, Video Current Time, Video Duration. These carry the detail your tag reports.
  2. Create the YouTube Video trigger

    Triggers → New → YouTube Video. Tick Start, Complete and Progress, and set progress thresholds to 10,25,50,75,90 percent.
  3. Let GTM fix the embeds

    Enable Add JavaScript API support to all YouTube videos so the trigger works even on iframes that didn't set enablejsapi=1 themselves.
  4. Fire a tag on the video events

    On a GA4 Event tag (or the Custom HTML - Test stand-in) firing on the trigger, send {{Video Status}}, {{Video Title}} and {{Video Percent}} as parameters.

Debug in Tag Assistant

Copy this lesson's live URL and paste it into GTM Preview, that is the page Tag Assistant connects to. It has the clickable elements, so this page stays clean for reading.

  1. In your GTM, click Preview.
  2. Paste the live URL above and click Connect.
  3. Interact with the live page and watch your tag fire in Tag Assistant.

What you should expect to see

Play the video on the live page. In Tag Assistant a gtm.video Start event appears, then Progress events at your thresholds, then Complete, each with Video Status, Video Percent and Video Title filled in, and your tag fires on each.

Verify your container

Built it? Export your container, Admin → Export Container, choose your workspace, then drop the JSON here to check it against this lesson.

Drop your container .json here

or browse · checked in your browser, nothing is uploaded