--- title: Migrating analytics tracking for custom headless builds description: >- Maintain analytics attribution for your custom headless integration as Shopify deprecates the `shopify_y` (unique visitor) and `shopify_s` (session) cookies. source_url: html: >- https://shopify.dev/docs/storefronts/headless/hydrogen/migrate/cookies-custom-setup md: >- https://shopify.dev/docs/storefronts/headless/hydrogen/migrate/cookies-custom-setup.md --- # Migrating analytics tracking for custom headless builds **Caution:** This configuration isn't officially supported by Shopify. This guide provides information about maintaining reliable [Shopify Analytics](https://help.shopify.com/en/manual/reports-and-analytics/shopify-reports) data for your custom headless build without using the `shopify_y` (unique visitor) and `shopify_s` (session) cookies, which will be deprecated on April 30, 2026. For Hydrogen apps (React Router/Remix) deployed to Oxygen or to another host, refer to [Migrate Hydrogen analytics tracking](https://shopify.dev/docs/storefronts/headless/hydrogen/migrate/cookies) instead. *** ## Implement a Storefront API proxy To migrate analytics tracking for a custom headless build, implement a [Storefront API](https://shopify.dev/docs/api/storefront/latest) proxy on your server to handle the new Shopify cookies within your storefront domain (refer to [the Hydrogen proxy implementation](https://github.com/Shopify/hydrogen/blob/27066a28577484f406222116a959eb463d255685/packages/hydrogen/src/storefront.ts#L546-L611) for an example). You'll use `hydrogen-react`'s [`useShopifyCookies({fetchTrackingValues: true})`](https://shopify.dev/docs/api/hydrogen-react/latest/hooks/useshopifycookies) to initiate a request to the Storefront API proxy to retrieve the cookies. If you're using custom analytics, then replace `getShopifyCookies` (now deprecated) with [`getTrackingValues`](https://shopify.dev/docs/api/hydrogen-react/latest/utilities/gettrackingvalues), which is a new export from `hydrogen-react`. With this utility, `uniqueToken` corresponds to the former `_y` value, and `visitToken` corresponds to the former `_s` value. ***