Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Webpixel cookies set current path

Webpixel cookies set current path

hrstrand
Shopify Partner
19 2 16

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 3 (3)

KB77
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

ErSanjay
Shopify Partner
325 20 47

@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.

Sizelabs
Shopify Partner
3 0 1

Hi @hrstrand did you find a solution for this?