Tag manager URL stripped out of the tag manager snippet
We are having exactly the same issue, as described here:
https://magento.stackexchange.com/questions/340300/javascript-url-being-stripped-out-of-html
Magento 2.4.4-p4
-
Hello Peter, thanks for your reply.
You were right! There is an Amasty GDPR module running a Plugin after rendering that strips away the tag manager URL.
Quite impressive stuff, if you ask me.
In case it helps anyone else, I modified the snippet code slightly so the regex expression of the Amasty module does not "match" the URL snippet, and leaves it alone. Something like:
...url = 'https://...' + i + dl;
changed to:
...url = 'h' + 'ttps://...' + i + dl;
(i.e. added a trivial concatenation so the regex /\'https:.../is/ fails to match.
-
That was my problem too - Amasty GDPR.
Realistically, this is not a problem but an expected behavior in the context of the GDPR. We must not track users without their express consent.
There is a solution without changing the code. Through the administration of Amasty GDPR, the cookie (_ga) must be marked as essential. But the GDPR problem remains :-)
-
I agree with you. I suspect the inconsistencies (users with all cookies accepted having the tag manager disabled in some pages) are probably due to full page cache layer (e.g. varnish) serving the same html version to customers with different Amasty module-related cookie values, so it is entirely possible that Amasty module is running as expected and the bug is caused by the combination of Amasty mod + full page cache.
Please sign in to leave a comment.
Comments
5 comments