I'm trying to setting gtm with partytown on astro but it's not working. I followed the documentation but the tags are not fired on my gtm and I also have some problems with CORS. If anyone has configured gtm with partytown on astro I would appreciate the help.
This is all my code:
<!-- Google Tag Manager -->
<script type="text/partytown">
(function (w, d, s, l, i) {
w[l] = w[l] || [];
w[l].push({ "gtm.start": new Date().getTime(), event: "gtm.js" });
var f = d.getElementsByTagName(s)[0],
j = d.createElement(s),
dl = l != "dataLayer" ? "&l=" + l : "";
j.async = true;
j.src = "https://www.googletagmanager.com/gtm.js?id=" + i + dl;
f.parentNode.insertBefore(j, f);
})(window, document, "script", "dataLayer", "GTM-ID");
</script>
<!-- End Google Tag Manager -->
My astro.config.mjs
integrations: [
tailwind(),
react(),
partytown({
config: {
forward: ['dataLayer.push']
}
})
],