partytown
partytown copied to clipboard
[🐞] TypeError: Failed to fetch using GTM
Describe the bug
Implementing party town with GTM we are seeing this kind of issue:
Reproduction
private integration environment
Steps to reproduce
put type="text/partytown" with the script of GTM
Browser Info
Chrome
Additional Information
No response
Tried to reproduce the issue and I don't see this type error. I've created my own gtag and placed the first item in the head and the noscript a child in the body. Is there anything more specific you can narrow down?
Also it looks like there's no id in this script. Just checking, was that done on purpose?
The issue is with Google tag manager (GTM script), are you use gtm.js or gtag.js? @thejackshelton
I ran into this today with an Astro site build. The Astro integration is fine. Getting the loading error after build. Here are my scripts, I think I am using gtag (but not a GA expert by any means):
<script
type="text/partytown"
src="https://www.googletagmanager.com/gtag/js?id=<MY_TAG>"></script>
<script type="text/partytown">
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag("js", new Date());
gtag("config", "<MY_TAG>");
</script>
packages:
@astrojs/partytown": "^2.0.4"
"astro": "^4.0.1",
I see, there are many Astro site with Partytown so I'm wondering if they have the same problem :thinking: This site is a working example
Thanks for showing the example. I must be doing something wrong. I'll revisit my implementation and see if I can figure out whats wrong with the above code. It is interesting that the site shown, clears the console (and the error), I haven't seen that before.