What's your biggest current challenge? Have your say in Community Polls along the right column.

Where is session ID stored in browser for a website build using shopify

Where is session ID stored in browser for a website build using shopify

ajs540
Shopify Partner
3 0 0

I need session ID for some analytics purpose, need to know where this particular field is stored in browser (cookies/local storage/session storage)
I assume this must be somewhere stored in cookie

What do I mean by session?
Follow the Shopify Analytics link & go to the [Acquisition] section.
1. Online store sessions (The number refers to how many different sessions occurred on your online store within the specified date range. The number of visitors is also displayed. A unique visitor might have more than one session)
i.e. a browsing session


Also attaching an image of cookies. Which field represent session ID
_shopify_s
_shopify_y

Also where can I find the documentation of of what each value in cookie/localStorage/sessionStorage represent (shopify docs are little hard to navigate)

 

 

shopify-session.png

Replies 2 (2)

PageFly-Theodor
Shopify Partner
691 86 103

Hi @ajs540 ,
This is Theodore from PageFly - Shopify Page Builder App.

 

Session IDs are typically stored in browser cookies. These cookies are temporary and vanish when you close your browser.

Shopify cookies named _shopify_s and _shopify_y likely store session data but their exact purpose might not be documented by Shopify.

A session represents your browsing activity on a website. A new session starts when you open your browser and visit a site. The session ID helps the site track your actions throughout that session.


Best regards,
Theodore | PageFly

 

Please let me know if it works by giving it a Like or marking it as a solution!


PageFly - #1 Page Builder for Shopify merchants.


All features are available from Free plan. Live Chat Support is available 24/7.

BSSCommerce-B2B
Shopify Partner
1969 564 566

Hi @ajs540,

 

You can find the session ID in cookies with key _shopify_y. This value has 1-year life time until you clear browser storage. You can access this value through Javascript using this code

ShopifyAnalytics.lib.user().traits().uniqToken

-> Result

BSSCommerceB2B_0-1719279474345.png

Identical to _shopify_y's value in cookies

BSSCommerceB2B_1-1719279540568.png

 

I hope my info is helpful to you.

B2B Wholesale Solution: Streamline your B2B operation with advanced features like wholesale registration forms, custom pricing.


B2B Portal, Quote, Net 30: Speed up purchasing and streamline your quotation process with advanced features like quick order, request for quote.


B2B Lock Password Protect: Easily control access to pages, products, and pricing with robust features.


BSS Commerce - Full-service eCommerce Agency I Use Shopify for 1$ in the first month now