partytown
partytown copied to clipboard
[🐞] Google Analytics Events aren't fired
Describe the bug
After setting up Google Analytics with Partytown (user analytics are working) events such as a purchase are not pushed to google analytics.
Reproduction
https://stackblitz.com/edit/sveltejs-kit-template-default-heabie?file=src%2Froutes%2F%2Blayout.svelte
Steps to reproduce
Setup google analytics with partytown properly. Push an event like
window.gtag("event", "purchase", {
DATA
});
Browser Info
All
Additional Information
When not using Partytown the events are properly pushed.
I see, thanks for your report. Can you create a PR with a failing test for this issue? A vanilla JS one will be perfect.
Did you use forwarding-events API ?
Did you use forwarding-events API ?
Yes
<script>
// Forward the necessary functions to the web worker layer
partytown = {
forward: ['dataLayer.push', 'gtag'],
};
</script>
A specific test for this issue will be awesome to solve this problem
Did you proxy the url to resolve CORS?
A specific test for this issue will be awesome to solve this problem
Not entirely sure how to write a test for it since I'm unfamiliar with this repo. https://stackblitz.com/edit/sveltejs-kit-template-default-heabie?file=src%2Froutes%2F%2Blayout.svelte should mostly replicate it.
Did you proxy the url to resolve CORS?
Everything else google analytics works so I don't think its CORS
Update: I just received an event in Google Analytics with this config so it might be something else that I have configured incorrectly. I'll give it a week to see what happens.
GA doesn't update data in real-time You can have more info here