Open nadinetetz opened 2 years ago
I believe we are seeing this bug as well; was a resolution ever found?
I think we're running into this too. We're including GTM via the <Script />
component, but once the GTM script has loaded, none of the custom HTML tags are ever run. The GTM debugger shows the tags as having "fired", but the logic within is never executed.
My working theory is:
This seems related to the following: https://github.com/vercel/next.js/issues/11012
A possible fix is here: https://github.com/vercel/next.js/pull/47938
Has anyone found a solution to this? My last resort is to update Next to 13.5.3, but I'd prefer not to as that will involve quite a bit of extra work at this point.
EDIT
Our issue actually stemmed from something completely different.. an engineer had patched Node.prototype.insertBefore
in a non-compliant way, causing GTM to be unable to write to the DOM. Hence, no tags were executed. Took a while to identify. Moral of the story... NEVER modify native browser API's people..
Verify canary release
Provide environment information
What browser are you using? (if relevant)
Chrome 105.0.5195.125
How are you deploying your application? (if relevant)
No response
Describe the Bug
I followed the example of how to add the google tag manager to a nextjs application. This works, but when I add a custom script tag via
next/head
the google tag manager is no longer added and the<meta charset="utf-8">
is duplicated.Expected Behavior
The custom script and the google tag manager are in the head and no meta tags are duplicated.
Link to reproduction
https://github.com/nadinetetz/nextjs-gtm-issue
To Reproduce
yarn && yarn dev