QwikDev / partytown

Relocate resource intensive third-party scripts off of the main thread and into a web worker. 🎉
https://partytown.qwik.dev
MIT License
13.11k stars 438 forks source link

[🐞] Segment parsing URL for UTMs is not working #502

Open alexandprivate opened 1 year ago

alexandprivate commented 1 year ago

Describe the bug

Segment parses the URL automatically looking for UTMs params, this manipulation involves location.search, when you visit the URL with UTMs params Segment automatically adds them to the context property in the event payload.

Documentation - https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/#utm-trackingadds

This is reproducible with any project loading partytown with segment

Reproduction

localhost:3000?utm_source=mysource&utm_medium=email

Steps to reproduce

Negative

Positive

Browser Info

Chrome, Safari

Additional Information

Seems that we need to forward location.search somehow but does not work, when you forward location. the URL changes on load and partytown shows a function instead:

From : http://localhost:10701/playground?utm_source=mysource&utm_medium=email
To: http://localhost:10701/function()%7B(t._ptf=t._ptf%7C%7C[]).push(i,arguments)%7D

Same result happens if you forward localtio.search or location.href, or location.pathname

dsacramone commented 6 months ago

@alexandprivate Did you sort this out, if so, how?