BuilderIO / partytown

Relocate resource intensive third-party scripts off of the main thread and into a web worker. 🎉
https://partytown.builder.io
MIT License
12.85k stars 426 forks source link

[Nextjs] Tracking event 3rd scripts not tracking all the events #210

Open steven-ruiz opened 2 years ago

steven-ruiz commented 2 years ago

Describe the bug

To Reproduce Steps to reproduce the behavior:

  1. Configure PartyTown for GA and Mixpanel to track pageview
  2. Make sure scripts are loaded via web worker
  3. Start navigating the website and check every pageview event is tracked

The second way to verify the lack of tracking events:

  1. Configure PartyTown for GA and Mixpanel to track pageview
  2. Configure a secondary script for GA and Mixpanel but load the scripts in the main thread with no party town
  3. Verify metrics after 24hrs and confirm that the events tracked by using PartyTown are less than using the main thread.

Reproduction link Since these are tracking events scripts I don't have a way to reproduce this in an online tool

Expected behavior The intention is to track every event.

Partytown version Partytown V0.6.0

misikoff commented 2 years ago

This only happens for me on particular combinations of Next.js versions and Partytown versions. The combo of Next.js 12.1.6 and partytown 0.6.1 appears to work properly for me.

piyushpriyadarshi commented 1 year ago

@misikoff @steven-ruiz can you please share the working code for tracking the events once we run the mixpanel into the webworker, i am able to run it in web worker but not able to access using global window object, can you please help me

mikkpokk commented 7 months ago

Same issue with Remix, realtime events dropped over 90% after migrating Partytown.

All my events from desktop come through but from iOS GA4 does not show most of the realtime information. While debugging network tab, it shows requests going through. Just GA4 registers only inital load events in some weird reason.

EDIT: Reverted Partytown migration and events popped up again within 30 minutes. I'm sorry I cannot provide any more details. It's really hard to guess what is wrong, I'm not aware what's going on under the hood.