Hello everyone,
I’m currently trying to set a domain-wide cookie in a Shopify project by using the usual JavaScript commands. Unfortunately, it seems Shopify doesn’t like the when I add the “path” to the cookie command, which is required to make it domain-wide. As soon as I do that, the cookie isn’t set at all anymore.
What am I doing wrong and what’s the best solution to fix this?
Thanks in advance!
1 Like
Move the cookie code out of a sandboxed pixel/section into the top-level layout (theme.liquid) or use the Web Pixels browser.cookie.set API so it runs in the top frame (sandboxed pixels restrict cookie/path behavior).
1 Like
I tried setting it at theme.liquid level and it also didn’t work. So I guess I’ll have to try the Web Pixel API. Thanks for pointing me in the right direction!
One more question, as I’m brand new to working with Shopify APIs
Do I insert the code for initializing and working with the API in the theme.liquid file, or somewhere else? Thanks in advance!