Cookie Condition for Audience Targeting and Goals
We’re introducing Cookie Conditions that gives you more flexibility when targeting users and defining experiment goals.
With this feature, you can now check for the presence of a specific browser cookie, optionally matching:
- a key/value pair inside the cookie
- a plain cookie value
- or simply the existence of the cookie
This condition is available in both Audience targeting and Goals, making it easier to personalize experiences and measure behavior based on cookie data.
Why This Matters
Cookies are often used by applications to store information such as:
- user identifiers
- session data
- feature flags
- preference settings
- tracking attributes from external systems
The new Cookie Condition allows experiments to react directly to this stored information, enabling more precise segmentation and measurement.
How It Works
When creating a rule, select Cookie as the condition type. You can then define:
- Cookie Name – the name of the cookie to inspect
- Optional Key – if the cookie stores structured key/value data
- Optional Value – the value to compare against
Example 1 — Check Cookie Exists
Target users who have a cookie named logged_in.
Cookie: logged_in
Condition: exists
This is useful for experiments that should only run for authenticated users.
Example 2 — Match a Plain Cookie Value
Check whether the cookie plan equals premium.
Cookie: plan
Value: premium
This enables targeting users based on subscription tiers or account types.
Example 3 — Match a Key/Value Pair
If a cookie stores structured data such as:
preferences=theme=dark&layout=grid
You can check a specific key:
Cookie: preferences
Key: theme
Value: dark
This allows targeting based on individual attributes within a cookie.
Use Cases
Audience Targeting
You can now include cookies directly in audience rules, for example:
- Show a campaign only to users with
campaign_source=partner - Target returning users with a
visited=truecookie - Personalize experiences based on stored preferences
Goal Tracking
The same condition can be used in Goals to measure outcomes:
- Track conversions when a
purchase_complete=truecookie appears - Measure events set by your backend through cookies
- Capture external system signals stored in cookies
More Flexible Experimentation
This new condition expands the ways you can integrate experiments with your existing application logic and tracking systems. Instead of relying solely on page events or custom scripts, experiments can now react directly to client-side cookie data.
If your application already uses cookies to store state or attributes, you can immediately use that information to target audiences and define experiment success criteria.
Give it a try in your next experiment and let us know how you use it!