- Issue created by @szloredan
- Merge request !17Issue #3340311: Create a submodule to load GTM only after consent. β (Open) created by szloredan
- Status changed to Needs review
almost 2 years ago 4:23pm 8 February 2023 - π©πͺGermany yannickoo Berlin
Patch works fine, the only thing I'm wondering about is the `data-src` attribute of the `
` inside the `` tag since there is no chance to execute that at all. Shouldn't we rather remove it completely? - π©πͺGermany hchonov πͺπΊπ©πͺπ§π¬
This breaks the loading of GTM when both usercentrics and simpleklaro are installed, but simple klaro is not enabled. Could we please add a check to ensure that Klaro is enabled and only then run the hooks?
- First commit to issue fork.
- last update
12 months ago 7 pass - π©πͺGermany hchonov πͺπΊπ©πͺπ§π¬
The current version is not loading GTM on urls that are consisting of multiple slashes, e.g. example.com/x/y will try to load the script from https://www.example.com/x/modules/contrib/google_tag/js/gtm.js which is clearly the wrong path. The issue relies in how the data-src is created and is missing the leading slash so the links look like this in the DOM before being processed by klaro:
<script src="/?snv6li" type="text/plain" data-type="application/javascript" data-name="google-tag-manager" data-src="modules/contrib/google_tag/js/gtm.js"></script>
Next to not having the leading slash one can also see that the version query string is added to the src and not to the data-src attribute which is also wrong.
- π©πͺGermany hchonov πͺπΊπ©πͺπ§π¬
The updated MR results into the following script on the page:
<script type="text/plain" data-type="application/javascript" data-name="google-tag-manager" data-src="/modules/contrib/google_tag/js/gtm.js?snvjrf"></script>