How to track YouTube videos via GTM
Create an event after starting a video on your page to trigger an action
Thanks to YouTube video Trigger in GTM, you can send an event based on the actions your users did while using Youtube.
Before you start
You need to have GTM implemented on your site. Find out how in here.
How to use it
You can create & configure the trigger in your GTM Workspace linked with your website.
1. Open your GTM Workspace connected to your website.
2. Go to Triggers and click the button New.
3. Choose Trigger Type: YouTube Video under User Engagement section. You have a number of options to pick from now:
- Start - tracks a start when the user starts watching the video.
- Complete - tracks a complete when the user reaches the end of the video.
- Pause, Seeking, and Buffering - tracks a pause when the user pauses the video or jumps forward or back, and buffering when the video starts buffering due to lack of bandwidth.
- Progress - track specific progress with percentage or timestamps in seconds. Input one or more positive integers in a coma-separated list.
There are also Built-in Variables helpful here - go to Variables > Configure > Videos, and there you have them!
These are Data Layer variables with their values:
To send an event triggered by this exact trigger, go to Tags > New > Tag configuration: Custom HTML and under Triggering choose your just set up YouTube trigger Tag. That will send this event to User.com.
Remember to previously create those event attributes inside your app, if the type of them is different than 'string'. To do this, go to: Settings > App settings > User data & events > Event attributes.
This is what you're going to see in User's profile - event and it's attributes: