How to Target Visitors Based on Browser Cookies

OptinMonster makes it easy to hide or show campaigns based on the cookies in your visitor’s browser.

In this article, you’ll learn how to use OptinMonster’s Display Rules to hide or show a campaign based on cookies.

Before you start, Cookie targeting is available with a Pro or higher subscription.

Configure Cookie Rule

When you create a campaign in OptinMonster you can configure it to be shown or hidden based on a visitor’s cookie.

To configure the cookie rule, follow these steps:

  1. Navigate to the Display Rules view in the campaign builder.
    Navigate to the Display Rules in the OptinMonster campaign builder.
  2. Next, when adding or editing a rule select Who (Personalization) from the left-hand list and select the Cookie Targeting option.
    Cookie targeting in OptinMonster.
  3. Configure the Key and Value operators and fields as you require.
    Configure the Cookie targeting rule in OptinMonster.
    The following match options are available:

    • Key only:
      • exists
      • does not exist
    • Value only:
      • empty
      • not empty
    • Key and Value:
      • exactly matches
      • does not exactly match
      • contains
      • does not contain
      • starts with
      • does not start with
      • ends with
      • does not end with
      • is empty
      • is anything (if the key or value is irrelevant choose this option)
      • matches the pattern
  4. When you’re finished, Save the campaign.


The cookie detection rule allows you to add real-time onsite retargeting campaigns.

For example, if you have an online store, your eCommerce software adds a cookie to every user who has purchased a product from you. When that customer returns to your website, you can use the cookie detection rule to show them a returning customer discount.

The best part is that cookie detection is happening in real-time. Meaning if a user just purchased Product A, you can immediately show them an upsell or special promotion for Product B.

Another use case would be for those who are using an advanced email marketing solution like Infusionsoft, ActiveCampaign, Pardot etc. to run a drip campaign. These solutions add subscriber-specific cookies to your users browser. You can use these to show personalized popups based on the stage the user is inside your marketing funnel.

If you’re serious about jumpstarting your website business growth, then get started with OptinMonster today!

Get Started With OptinMonster Today!

BONUS: Done-For-You Campaign Setup ($297 value)
Our conversion experts will design 1 free campaign for you to get maximum results – absolutely FREE! Click here to get started →


Cookies are little pieces of data in a web browser that is unique to each site. Each cookie contains only bits of text, nothing else. The text can be a user ID, session ID or any other text.

Cookies are very common, it’s normal to have hundreds or even thousands stored in your browser at any given moment.

For example, cookies help a website determine if you’ve logged into an account and keep you logged in while you continue browsing through the site. Clearing your cookies on that site would immediately log you out of your account.

All cookies have a key and a value: key=value. For example, a cookie could be: country=us

This question is best answered by your web developer, as it depends on your site’s structure, coding language, and your goals.

Here are a few articles to help you learn how to do this effectively:

How do I hide this campaign if the visitor has already seen one of my campaigns?

To hide or show a campaign based on the visitor seeing another specific campaign can be done using MonsterChains.

If you want to hide all campaigns on your site after the visitor has seen or subscribed to any of your campaigns, then you should configure global cookies.