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 98

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 Expert
564 112 135

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.

If our suggestions are useful, please let us know by giving it a like, marking it as a solution.


B2B Solution & Custom Pricing |BSS: B2B Portal, Quote, Net 30 | BSS: B2B Login Lock Hide Price


Need help from our expert? Kindly share your request with us via community@bsscommerce.com


BSS Commerce - Full-service eCommerce Agency