- Issue created by @luke.leber
While contemplating a switch to the google_tag
module, it seems that multiple Container Loaded
triggers may be occurring. Upon further investigation, it seems that there is some overlap happening between the gtm.js and gtag.js libraries. Both libraries run code that initiates a Container Loaded
trigger.
From gtm.js:
window[dl].push({'gtm.start': new Date().getTime(), event:'gtm.js'});
From gtag.js:
gtag('js', new Date());
Debug output from the GTM inspector:
While the impact of this is relatively benign in nature, it could very well be a source of confusion. Typically one wouldn't expect the same container to have multiple loaded triggers firing for the same page view.
Container Loaded
triggers.At this point, comment out either https://git.drupalcode.org/project/google_tag/-/blob/2.0.x/js/gtm.js?ref... or https://git.drupalcode.org/project/google_tag/-/blob/2.0.x/js/gtag.js?re... and repeat the steps.
Note that only one Container Loaded
trigger occurs, as expected.
Only push one such event into the datalayer when both gtm.js and gtag.js are loaded together.
TBD
TBD
TBD
TBD
Active
2.0
Code