I am facing an issue with YouTube event tracking in Google Tag Manager (GTM) for Google Analytics 4 (GA4). I have implemented the event tracking manually, as the enhanced measurement feature is not working for me.
The problem is that the YouTube event tracking fires correctly for the first video played when I test it in preview mode. However, subsequent videos that are played and clicked are not being detected in preview mode by the youtube event. They are recognized as link clicks.
I have tried:
- Enabling the trigger en container loaded (this is actually the only way it will read at least the first video clicked)
- Implementing the a Custom HTML that fires on all pages with the highest priority. This is the the full HTML that analyticsmani suggested:
"script src="https://www.youtube.com/iframe_api"
I am expecting to see the event fire with the event tag every time I click on a video and not only the first one.
It's worth noticing that each video is contained inside a modal. The modal activates once you click on a call to action (example: Watch more >> modal opens >> users clicks >> video starts)