You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We recently adopted Partytown for a Shopify OS 2.0 shop and ran into some trouble integrating Partytown with our Tagging Server. One thing I quickly realized was that tracking cookies weren't set at all in the shop. document.cookie works fine, but cookies from the server get set by HTTP headers, which doesn't seem to work.
I did a little testing and apparently the issue is using XMLHttpRequest inside Web Workers, even if the withCredentials property is properly set. I could reproduce that cookies are neither send to, nor set by the server using XMLHttpRequest.withCredentials (which Google Analytics does for example).
The fetch-API doesn't have the same issue as long as the credentials-setting is included. I set up a small test site (it's a personal test site without proper consent management, so be warned) that checks on cookies using different Tagging-Methods. You can click the links at the top of the page to go through scenarios:
SGTM (Server Side Tagging)
SGTM & PT (Server Side Tagging inside Partytown)
GTM (Client Side Tagging)
GTM & PT (Client Side Tagging inside Partytown)
I also included a TEST-COOKIE that gets set from a fetch-Request inside Partytown if you're using Server Side Tagging. You'll notice that all client cookies get properly set when using Client Side Tagging with or without Partytown. Server Side Tagging also works just fine without Partytown, but adding Partytown to the mix only sets the TEST-COOKIE from fetch but fails to set all the others from XMLHttpRequest.
Has anyone tested an implementation of Partytown and Server Side Tagging and is able to provide some insight?
The text was updated successfully, but these errors were encountered:
For all scripts that use XMLHttpRequest, I added a new class that implements the original API but uses fetch under the hood. It seems to work. I branched off of https://github.com/apple502j/xhr-shim/blob/main/src/index.js and serve the shim directly from a Cloudflare URL Proxy.
I'm currently trying to set up a test that shows the issue and a potential PR that includes the shim directly in Partytown. It's probably a niche issue, but being able to run Partytown with a Tagging Server (or anything that tries to Set-Cookie from HTTP headers) would be a nice benefit.
Hey folks!
We recently adopted Partytown for a Shopify OS 2.0 shop and ran into some trouble integrating Partytown with our Tagging Server. One thing I quickly realized was that tracking cookies weren't set at all in the shop.
document.cookie
works fine, but cookies from the server get set by HTTP headers, which doesn't seem to work.I did a little testing and apparently the issue is using
XMLHttpRequest
inside Web Workers, even if thewithCredentials
property is properly set. I could reproduce that cookies are neither send to, nor set by the server usingXMLHttpRequest.withCredentials
(which Google Analytics does for example).The
fetch
-API doesn't have the same issue as long as thecredentials
-setting is included. I set up a small test site (it's a personal test site without proper consent management, so be warned) that checks on cookies using different Tagging-Methods. You can click the links at the top of the page to go through scenarios:I also included a
TEST-COOKIE
that gets set from afetch
-Request inside Partytown if you're using Server Side Tagging. You'll notice that all client cookies get properly set when using Client Side Tagging with or without Partytown. Server Side Tagging also works just fine without Partytown, but adding Partytown to the mix only sets theTEST-COOKIE
fromfetch
but fails to set all the others fromXMLHttpRequest
.Has anyone tested an implementation of Partytown and Server Side Tagging and is able to provide some insight?
The text was updated successfully, but these errors were encountered: