Why track YouTube videos interactions?
Tracking interactions with YouTube videos enables you to understand your visitors’ engagement and thus go beyond simple page views, clicks or scrolls in your analysis.
In particular, these interactions can help you determine whether visitors who watch your videos convert better than other visitors.
Configure the Youtube Video trigger
As YouTube and Google Tag Manager are both owned by Google, there’s a native trigger in GTM that lets you track interactions with YouTube videos on your site.
The trigger is called YouTube Video, and here’s how it works:

Explanations of the checkboxes in the Capture section:
- Start: triggers when the video is played (Video Status ->
start) - Complete: triggers when the video has been played in full (Video Status ->
complete) - Pause, Seeking and Buffering: triggers when the video is paused or when it is moved forward or backward (Video Status ->
pauseorseek) - Progress: triggers on percentage/second thresholds viewed in the video
Here’s how I recommend configuring the YouTube Video trigger in GTM:

Enable built-in video variables in GTM
In the Variables section of Google Tag Manager, click on Configure.

Then check all the built-in variables in the Videos section.

Explanations of built-in variables:
- Video Current Time: Current video duration in seconds
- Video Duration: Total video duration in seconds
- Video Percent : Video Current Time / Video Duration x 100
- Video Provider: Name of video provider (here
youtube) - Video Status: Video status (
start,progress,pause,seek,complete) - Video Title: Video title
- Video URL: URL of the video on YouTube
- Video Visible:
trueif the video is visible on the visitor’s screen at the time of triggering, andfalseif the video is not visible (e.g. the visitor has played the video and then scrolled to the bottom of the page, or the visitor is on another tab during playback).
Note that built-in variables will always be available regardless of how you configured the trigger in the Capture section.
Configure GA4 tag
In the GA4 tag, we’ll use the video_start, video_progress and video_complete events.
Then trigger the tag on the previously created YouTube Video trigger.

Advanced settings: Javascript API
The Javascript API makes it possible to track YouTube videos even if they are deferred loading by the website.
Enabling the Javascript API will add enablejsapi=1 to the src attribute of the YouTube video iframe, thus loading the https://www.youtube.com/iframe_api script. If the video is playing when the YouTube Video trigger loads, the video will reload to add this parameter and thus activate the Javascript API.
You can therefore check the box Add JavaScript API support to all YouTube videos in the YouTube Video trigger in GTM or add it manually in your website code on Youtube iframes.
Let's talk about your tracking
A question about this article, need an audit of your setup or server-side migration? Drop me a line, I reply within 24h.

