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
).
- Shopify sets a cookie called
Workaround for breaking the Shopify Theme Test cookie:
- If you don’t want returning traffic to see a Variant Theme after testing:
- Duplicate the Theme (if you want to keep it around), then Delete the original Variant Theme from the test.
- Or, if you don’t need the theme, you can just delete it.
- This ensures that even if the 1-year cookie persists, visitors will no longer be served the Variant Theme.
- 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.”