Shopify Deprecates _shopify_y and _shopify_s Cookies

Shopify Deprecates _shopify_y and _shopify_s Cookies

Shopify Updates: 

What's Changing?

Starting January 1st, 2026, Shopify will no longer set the following cookies on merchant storefronts:

  • _shopify_y
  • _shopify_s

Required Updates

While accessing internal cookie values has never been recommended due to frequent changes, any code currently depending on these cookie values must now be adapted to use documented APIs.

Replacement for _shopify_y

If you're accessing _shopify_y via document.cookie, you will need to migrate to Web Pixels, specifically using the clientID property available in any Standard or DOM event. Refer to Shopify's API documentation for more details.

Example: Custom Pixel Implementation

Follow these steps to log the clientID (the new equivalent of _shopify_y):

  1. Navigate to Admin > Settings > Customer Events > Custom Pixels.
  2. Add the following JavaScript to a Web Pixel:
analytics.subscribe('page_viewed', (event) => { 
  console.log("The client's ID is ", event.clientId);
});

This script logs the ID on every page view, provided user consent is given.

Replacement for _shopify_s

Shopify will not provide a direct replacement for _shopify_s. However, you can create a session-length cookie using browser APIs or the Web Pixels API’s browser interface. Here's a code snippet for establishing equivalent functionality:

var sessionCookie = 'session_id';
var sessionExpiry = new Date(Date.now() + 30 * 60 * 1000); // Expires in 30 minutes.
document.cookie = `${sessionCookie}=your_value; expires=${sessionExpiry.toUTCString()}; path=/`;

Next Steps

Ensure you review your code and implement these changes well before the January 2026 deadline. For detailed documentation, visit Shopify's official API reference.

Back to blog