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.
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
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:
Same result happens if you forward localtio.search or location.href, or location.pathname