Webpixel cookies set current path

Shopify Partner
19 2 14

I am working on an analytics app, and using the new WebPixel api to track user events.

To track a single user, I use the browser.cookie.set("mysessionid", some_generated_id) function to set a session id if it is not already being set.

There is a issue with reading this value consistently, and I've tracked it down to the fact that the set cookies also have a path, which is set from whatever page the cookie was set on, making it impossible to read the cookie from a different path 


Screenshot 2022-07-01 at 22.06.06.png

( from chrome dev tool - two cookies with same name, different path. Depending on path of current page, my pixel code will read one or the other ) 


The api function does not enable me to set a path - so I am either using this wrong or there is a path variable needed in the api call. Any ideas?



Developer of Realtime View : https://apps.shopify.com/realtime-view
Replies 2 (2)

Shopify Staff
59 6 11

In order to investigate a bug report we will  require further information on how the app in question is interacting with the API  such as the request body and headers, as well any response errors and response headers (x-request-id, cursor) from the error. Our API team can then take a look using internal tools and logs. If you can submit this issue using the Report an Issue Form here https://help.shopify.com/en/questions/partners#/contact/report-an-issue it will help expedite the process as this will enable us to authenticate access where necessary. Thank you. 

KB77 | API Support @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

Shopify Partner
307 20 46

@hrstrand  you need to add the root domain to access the cookies across the domain and create shared cookies. 


Business Owner & Shopify Plus, Shopify app , Shopify Consultant - Full Stack Sofware Engineer
Warm regards,
Er Sanjay

If you find yourself in need of assistance with your store, don't hesitate to reach out! Feel free to send me a direct message, and I'll do my best to help you out.