Skip to content

Google Tag Manager conflict

Yuhui edited this page May 18, 2024 · 1 revision

If your web site has Google Tag Manager (GTM) with video tracking, then the YouTube Playback extension will not work properly.

About Google Tag Manager

Google Tag Manager, or GTM, is a tag management system provided by Google. It provides native support for tracking YouTube videos.

When video tracking is used in GTM, then GTM will enable playback tracking in the videos. To identify these enabled videos in your web page:

  1. Inspect the HTML code using your web browser's development panel.
  2. In the YouTube video's <iframe> HTML code, you will find several attributes starting with data-gtm-yt-inspected.

Google Analytics 4 with Enhanced Measurement

Although you may not have GTM in your web site, but if you have implemented Google Analytcs 4 (GA4) with Enhanced Measurement, then YouTube videos will be enabled for tracking in a similar manner.

Conflict

Both Google and the YouTube Playback extension (and, in general, all scripts that provide YouTube video playback tracking) rely on the YouTube IFrame API to detect users' playback behaviour, like plays and pauses.

Unfortunately, this causes video tracking to not work properly (or even fail entirely) with the YouTube Playback extension.

No support provided

The YouTube Playback extension is developed with the intention of working properly with AEP Tags. It assumes that all video tracking is done with AEP Tags only. Where possible, effort has been made to make the extension work nicely with GTM (nor GA4 with Enhanced Measurement). But there is no intention to resolve all of these conflicts because that is not the focus of the extension's development.

Suggested approach

The following suggestion is provided as a courtesy. No support is provided for resolving video playback tracking problems when GTM (or GA4 with Enhanced Measurement) is used in your web site.

  • Do not use the YouTube Playback extension in AEP Tags.
  • Rely on GTM for all of your video tracking needs.
    • Add a Custom HTML tag with this code:
    <script>
        /**
         * Assume that the AEP Tags property has been loaded in the web page already.
         *
         * There should be a corresponding Rule in the AEP Tags property
         * that gets triggered by this Direct Call
         */
        _satellite.track('enable YouTube video tracking');
    </script>
    • Trigger this Custom HTML tag with the "YouTube Video" trigger.

If it all works well, then when GTM detects playback in the YouTube video, it will run the Custom HTML tag to trigger the Direct Call in your AEP Tags property. Then, in AEP Tags, you can track the video playback.

Any further implementation is left up to you. No support is provided for tracking video playback in GTM (nor GA4 with Enhanced Measurement).