--- title: getShopifyCookies description: Parses cookie string and returns Shopify cookies. For tracking values, consider using `getTrackingValues` instead, which reads from modern Shopify cookies. api_version: 2026-01 api_name: hydrogen source_url: html: https://shopify.dev/docs/api/hydrogen/latest/utilities/getshopifycookies md: https://shopify.dev/docs/api/hydrogen/latest/utilities/getshopifycookies.md --- # get​Shopify​Cookies Parses cookie string and returns Shopify cookies. For tracking values, consider using `getTrackingValues` instead, which reads from modern Shopify cookies. ## get​Shopify​Cookies(**[cookies](#getshopifycookies-propertydetail-cookies)**​) If the Shopify cookies doesn't exist, this method will return empty string for each missing cookie. ### Parameters * **cookies** **string** **required** ### Returns * **ShopifyCookies** ### ### ShopifyCookies * **\_shopify\_s** **string** Shopify session token: Value of `_shopify_s` cookie. * **\_shopify\_y** **string** Shopify unique user token: Value of `_shopify_y` cookie. ### ShopifyCookies * \_shopify\_s Shopify session token: Value of \`\_shopify\_s\` cookie. ```ts string ``` * \_shopify\_y Shopify unique user token: Value of \`\_shopify\_y\` cookie. ```ts string ``` ## ShopifyCookies Shopify cookies names * **\_shopify\_s** **string** **required** Shopify session token: Value of `_shopify_s` cookie. * **\_shopify\_y** **string** **required** Shopify unique user token: Value of `_shopify_y` cookie. Examples ### Examples * #### Example code ##### Description I am the default example ##### JavaScript ```jsx import * as React from 'react'; import {useEffect} from 'react'; import {getShopifyCookies} from '@shopify/hydrogen'; export default function App({Component, pageProps}) { useEffect(() => { getShopifyCookies(document.cookie); }); return ; } ``` ##### TypeScript ```tsx import * as React from 'react'; import {useEffect} from 'react'; import {getShopifyCookies} from '@shopify/hydrogen'; export default function App({Component, pageProps}) { useEffect(() => { getShopifyCookies(document.cookie); }); return ; } ``` ## Related [Hook - useShopifyCookies](https://shopify.dev/api/hydrogen/hooks/useShopifyCookies) [Utility - getTrackingValues](https://shopify.dev/api/hydrogen/utilities/getTrackingValues)