Understanding A/B Testing Cookie Retention
A/B Testing Cookie Retention FAQ
Q: What is the cookie retention period when a visitor hits an A/B Test?
A: It depends on the type of test:
Theme Tests
Shopify sets a cookie called _shopify_essential that locks a visitor into the theme they preview.
Expiry: 1 year from when it’s set.
To exit, a user must either:
- Delete the cookie, or
- Navigate to another theme using a parameter (
?preview_theme_id=123).
Behavior When Ending Theme Tests
The default behavior when ending Theme Tests is as follows:
- If a customer is browsing on your current published theme and you publish a new theme, the customer will automatically see the newly published theme (this will stop you from collecting any new analytics events on the current test).
- If a customer was assigned to a Variant Theme during a Theme Test and the test ends, they are redirected to your default (published) theme.
- If you later publish a new theme, those customers will automatically see the newly published theme as well.
This ensures customers are no longer persistently locked into outdated variant themes after a test ends.
Note on Previous Workaround
Previously, you needed to duplicate and delete Variant Themes to prevent returning visitors from continuing to see them due to Shopify’s 1-year cookie.
This manual workaround is no longer required when ending Theme Tests.
Split URL, Page, and Template Tests
Variants are cached for the session.
Expiry: 2 hours after inactivity (based on Shopify’s _shopify_s session cookie).
Analytics Cookies
Our analytics layer sets a session cookie without a fixed expiry.
Expiry: Lasts for the browser session (until the window is closed or cookies are cleared).
Q: Do we use our own cookies for A/B test functionality?
A: No, the A/B test behavior relies entirely on Shopify’s cookies.
Q: Where can I find Shopify’s official cookie policies?
A: Shopify Cookie Policy → See section “Reporting and Analytics.”