Cookie Targeting
Segment visitors based on cookies and create tailored website experiences for each segment.
Cookie Targeting is an OptiMonk targeting condition that lets you show or hide campaigns based on the name and value of cookies present in a visitor's browser. Because cookies are set by your website, your ecommerce platform, third-party tools, and OptiMonk itself, they contain a rich set of visitor signals — landing page, account status, A/B test variant assignment, consent tier, loyalty tier, and much more — that are not always exposed through OptiMonk's standard targeting rules. Cookie Targeting gives you direct access to any of this data: you specify a cookie name, select a matching operator (equals, contains, starts with, ends with, greater than, less than, exists, does not exist, and their inverses), and enter the value to match against. The condition evaluates in real time each time a campaign is about to display, reading the current state of the visitor's cookies at that moment. Multiple conditions can be combined with AND logic (all must match) or OR logic (at least one must match), and Cookie Targeting can be stacked alongside other targeting rules like URL conditions or cart rules for precise compound audience definitions.
Key benefits
- Tap into any data your site already tracks about visitors. Every platform that runs on your store — your ecommerce engine, your CRM, your analytics tool, your A/B testing software — writes data about each visitor into browser cookies. Cookie Targeting gives OptiMonk access to that existing data pool without requiring any additional integration or data export. If a cookie exists in the visitor's browser, you can use it as a targeting signal — from Shopify's customer login cookies to custom loyalty tier flags your developers set.
- Target segments that no other rule can reach. Standard targeting conditions cover visitor location, cart contents, page URL, and behavioral history — but they cannot see custom business logic encoded in your own cookies. Cookie Targeting fills that gap: you can show a campaign only to visitors tagged as VIP customers in a custom cookie, exclude visitors who are already assigned to a specific A/B test variant by another tool, or target visitors whose cookie indicates they accepted a specific marketing consent category — none of which is possible through OptiMonk's other targeting rules alone.
- AND/OR logic for precise multi-condition cookie rules. A single Cookie Targeting condition can be extended with multiple sub-rules using AND (all conditions must be simultaneously true) or OR (at least one condition must be true) logic. For example, you can show a campaign only to visitors whose loyalty cookie equals "gold" AND whose account type cookie does not equal "staff" — combining cookie conditions into a tight segment without needing to create separate campaigns for each variation.
How it works
Open your browser's developer tools (in Chrome: Ctrl+Shift+I → Application → Storage → Cookies) while visiting your store to see which cookies your site sets and what values they contain. Note the exact name and the expected value for the segment you want to target — for example, a cookie named customer_tier with the value gold.
In your campaign's targeting settings, click Add new condition and select Cookie targeting. In the rule configuration, enter the cookie name in the first field, select the data type (text or number), choose your matching operator from the dropdown (equals, contains, starts with, ends with, greater than, less than, exists, does not exist, and their negations), and enter the expected value. Add additional cookie conditions using the Plus icon for AND logic or the Add new button for OR logic.
When the campaign trigger fires for a visitor, OptiMonk reads the visitor's current browser cookies and evaluates them against your configured conditions. If the cookie name and value match the rule, the campaign displays; if not, it is silently suppressed. The evaluation happens at display time, so any cookie that changes during the session — such as one updated after a visitor logs in — is reflected immediately without requiring a page reload or session restart.
Frequently asked questions
What is Cookie Targeting in OptiMonk?+
Cookie Targeting is a targeting condition in OptiMonk that shows or hides campaigns based on the presence, name, and value of cookies in the visitor's browser. You define a cookie name, a matching operator, and an expected value — and OptiMonk evaluates the visitor's cookies at display time to determine whether the campaign should fire. Multiple conditions can be combined with AND or OR logic, and the feature works with any cookie set by your website, platform, or third-party tools.
Which cookies can I use for targeting?+
You can target any cookie that is present in the visitor's browser when they visit your site — including cookies set by your ecommerce platform (Shopify, WooCommerce, etc.), your analytics tools, your CRM, other third-party scripts, or custom cookies your development team has created. To discover which cookies your site uses and what values they contain, open your browser's developer tools, navigate to Application → Storage → Cookies, and inspect the list while visiting your store.
What matching operators are available for cookie values?+
Cookie Targeting supports a range of operators for both text and numeric cookie values. For text cookies: equals, does not equal, contains, does not contain, starts with, ends with, exists (cookie is present regardless of value), and does not exist (cookie is absent). For numeric cookies: equals, does not equal, greater than, less than, and their combinations. This covers both presence-based targeting (does this cookie exist?) and value-based targeting (does this cookie contain a specific string or fall within a numeric range?).
Can I combine multiple cookie conditions in one rule?+
Yes. Within a single Cookie Targeting condition, you can add sub-rules using AND logic (the Plus icon — all conditions must be simultaneously true) or OR logic (the Add new button — at least one condition must be true). This lets you define precise compound cookie segments — for example, show the campaign to visitors whose membership_tier cookie equals "gold" AND whose opted_out cookie does not exist — within a single targeting block.
Do I need developer help to use Cookie Targeting?+
Not necessarily for reading existing cookies. Any marketer comfortable with browser developer tools can inspect their site's cookies and configure Cookie Targeting using the names and values they find there. However, if you want to create new custom cookies specifically for OptiMonk targeting — for example, a cookie that flags VIP customers or records a specific behavioral event — that typically requires a developer to write and deploy the cookie-setting logic on your site. Once the cookie exists, configuring the targeting rule in OptiMonk is straightforward.
Try OptiMonk for free
Launch your first campaign, learn what works, then scale what converts.