What is Vary Cache?
1 min read
Vary Cache is a new feature in FastPixel which will store different cached versions of the same page depending on the value of one or more cookies you choose.
Normally, a page cache works like this:
- User A visits
/about - The page is generated and cached
- User B visits
/about - User B gets the same cached page
With cookie-based variation:
- User A has cookie
membership=gold - User B has cookie
membership=silver - The cache stores separate versions of
/aboutfor each cookie value - Each user receives the correct cached content
Please note that Vary Cache will not work if you do not set one or more important cookies!

Why it’s needed #
Some websites show different content based on cookies, such as:
- Logged-in vs logged-out users
- Membership levels
- Geographic preferences
- Language selectors
- A/B testing variants
- WooCommerce cart/session states
- Location based currency or tax
Without varying by cookie, users could see the wrong content because everyone would receive the same cached page.
Trade-offs #
Pros
- Allows caching personalized content.
- Improves performance compared to disabling cache entirely.
Cons
- Can dramatically increase cache size if cookie values are highly variable.
- May reduce cache hit rates because fewer visitors share the same cached page.
Important caution #
Avoid varying by cookies that contain unique values per visitor, such as:
session_id=abc123
session_id=xyz789
This effectively creates a separate cache for every user, defeating most of the performance benefits of page caching.
A good rule is: only vary by cookies that have a small number of possible values and actually affect what is rendered on the page.