YouTube Iframe API Loader - Custom Tag Template

The YouTube iframe API loader custom tag template is an unofficial tag template for Google Tag Manager’s community template gallery.

Vendor documentation
Gallery entry
GitHub repo


A tag created with this template loads the library on the page. This is necessary if you want to track interactions in lazy-loaded or dynamically added videos with Google Tag Manager’s native YouTube video trigger.


Simply add a Page View trigger to the tag (you can delimit this further to only fire on pages that will have videos inserted on them), and it will insert the library on these pages.

You only need to do this on pages that have dynamically inserted videos. If the page loads with YouTube videos, you do not need this template. You can simply use the default YouTube trigger, as it will automatically load the API if it finds a YouTube video on the page when it first loads.

Release notes

Date Changeset
3 April 2020 Initial release.