Skip to content

Different loading order, if tag manager gets loaded via "Script" or "HTML"

I found a problem while integrating Google Consent Mode with Google Tag Manager.

image

If I use the "Script" field, the loading order is correct and I don't get any problems with the setting / update mechanism of the users consent.

In this case the statement updates the users consent and afterwards fires the event "gtm.init_consent" so the updated consent is already available.

image

If I use the "HTML" field, the loading order is different and at first the tags are not fired, only after reloading the page.

In this case first the event "gtm.init_consent" is fired, and afterwards the user consent is updated, that the event "gtm.init_consent" doesn't have the users consent.

image

Both screenshots have an identical Google Tag Manager initialization + GTM trigger

TYPO3 12.4 / 13.4 and sgalinski 7.0.11

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information