Important: if you are looking for a recipe that supports Universal Analytics, go here
What does it do? Automatically tracks interactions with embedded YouTube videos on your site. This recipe will fire events to Google Analytics 4 when users start the video, watch a certain percentage of the video (25%, 50%, 75%), or complete it.
Attention: if none of the aforementioned Youtube tracking recipes are working, read this guide.
Read the blog post on how this recipe is created.
If you want a single recipe that supports both GA4 and Universal Analytics, click here.
- Download Container File
Download the container JSON file (right-click on the link and click “Save Link As” or “Save Target As” to save the JSON file to your computer).
- Import JSON File into GTM
Log into your own Google Tag Manager container and head to the Admin section of the site. Under Container options, select Import Container. Read this blog post for more details about importing a container file.
- Insert your own GA4 configuration tag
In the GA4 event tag, you will find a field called “Configuration tag”. In this field, select your own GA4 configuration that you already have in the container. New to GA4 config tag? Read this guide.
- Preview & Publish
Use the Preview options to test this container on your own site. Try testing each of the events to make sure they’re working properly. If everything looks good, go ahead and publish!
- Want to see event parameters in your regular GA4 reports or Analysis Hub?
Register them as custom dimensions.