In this section, I will share how to track YouTube video playback on the website.
- Method 1: Enhanced Measurement Events, Enhanced Measurement has a built-in Video engagement that can track Youtube Video.
- Method 2: Youtube Video Trigger, in fact, Google Tag Manager has a built-in Youtube Video Trigger, it is very easy to track using this trigger.
Suppose now to track the video on https://www.bbccss.com/youtube-test
Enhanced Measurement Events
In Google Analytics 4 , click 「Admin」——「Data Streams」, open Web stream details, and then click the Settings icon for Enhanced measurement, you will see “Enhanced measurement”:
Check “Video engagement” and click Save.
This completes the video tracking of Enhanced Measurement Events.
Youtube Video Trigger
Google Tag Manager has a built-in Youtube Video Trigger, it is very easy to track Youtube Video using this trigger.
Turn on built-in variables
There are already many built-in variables in Youtube video triggers, which will be used later. Let’s enable them first.
Click「Variable」——「Configure」 , check all the Video type variable:
Set Triggers
Click 「Trigger」——「New」——「Choose a trigger type to begin setup..」——「YouTube Video」:
There are 4 types of Capture options:
- Start: Fires an event when the video begins to play.
- Complete: Fires when the video finishes.
- Pause, Seeking, and Buffering: If the video is paused, the scrub bar is moved, or if the video buffers, the trigger will fire.
- Progress: Fires at specified video progress points, configured by percentage or time threshold values:
- Percentages: This value indicates the percentage of the video that has been played. Enter percentages as a comma separated list of one or more integers. Example: 5, 20, 50, 80, which represents 5%, 20%, 50%, and 80% respectively.
- Time Thresholds: This value represents the number of seconds that the video has played. Enter time thresholds as a comma-delimited list of one or more integers. Example: 5, 15, 60, 120, which represents 5 seconds, 15 seconds, 60 seconds, and 120 seconds respectively.
- Advanced——Add JavaScript API support to all YouTube videos: Check this box to enable the YouTube iFrame Player API. If you are copying videos from Youtube, you don’t need to enable it.
- Enable this trigger on: Select the appropriate option, For best results Window Load (gtm.load) is the recommended option.
- Container Load (gtm.js) occurs as soon as possible when the page loads.
- Window Load (gtm.load) (default) occurs after all initial content on the page has loaded.
- DOM Ready (gtm.dom) occurs after DOM is ready to be parsed.
Here we track the basic operations of the video, such as Start, Complete, Pause, Seeking and Buffering, configured as follows:
Set Tags
Click 「Tags」——「New」——「Choose a tag type to begin setup..」——「Google Analytics: GA4 Event」, name it “Video Tracking” and set it as follows::
- Configuration Tag : this is the basic configuration of GA4, Pageview configuration.
- Event Name:Custom event name, I define it as “Youtube” here
- Event Parameters: To customize event parameters, you can set built-in variables as event parameters, such as I set video_title for video_name.
- Triggering:Set the trigger, which is the trigger created in the previous step.
The setting of Tags is complete.
Preview
See, events are all triggered:
Then to Google Analytics 4 DebugView:
You can see Youtube event , so you can publish.