How to Target Visitors Based on Browser Cookies

Would you like to have the ability to target a user’s cookies to show or hide your OptinMonster campaign? Are you interested in retargeting your existing site visitors to increase your sales on your site?

REQUIREMENTS: The Cookie Detection rule requires a Pro Subscription.

What is the Cookie Detection Rule?

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.


How to Use the Cookie Detection Rule

You will find the cookie detection rule in the Display Rules tab of the Builder.

Display Rules Tab

To target a user’s cookie, set the display rule to a cookie.

Cookie Detection Rule

From there, you can add the cookie’s name and value that you would like to target.

Cookie Rule Settings

The following options are available for cookie targeting:

  • 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
  • matches the pattern

If either the cookie’s name or value is irrelevant, use the is anything option.

WARNING: to help ensure your campaign loads as expected, please review our Display Rules documentation where Rules and Rulesets are discussed, and how to set proper AND and OR conditions.
Congratulations, you’ve successfully added a Cookie Detection rule!

You may consider in the future pairing this rule with other actions such as the number of pages as visitor has seen on your site.


Frequently Asked Questions

A: Cookies are little pieces of data in a web browser that is unique to each domain. Mozilla and Microsoft both give full definitions below:
___

“An HTTP cookie (web cookie, browser cookie) is a small piece of data that a server sends to the user’s web browser. The browser may store it and send it back with the next request to the same server. Typically, it’s used to tell if two requests came from the same browser — keeping a user logged-in, for example. It remembers stateful information for the stateless HTTP protocol.”
Mozilla Developer Network

___

“Cookies provide a means in Web applications to store user-specific information, such as history or user preferences. A cookie is a small bit of text that accompanies requests and responses as they go between the Web server and client. The cookie contains information that the Web application can read whenever the user visits the site.

The browser manages the cookies on client computers. Cookies are sent to the client using the HttpResponse object, which exposes a property called Cookies. Any cookies that you want your Web application to send to the browser must be added to this collection. When you write a new cookie, you must specify the Name and Value. Each cookie must have a unique name so that your Web application can identify it when the browser sends it with future requests.”
Microsoft Developer Network

___

Cookies have a name and a value: name=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. However, here are a few articles to help you learn how to do this effectively:


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

A: If you’re wanting to show / hide this campaign if the visitor has seen a specific campaign, you will want to check out our MonsterChain documentation.

If you want to hide all campaigns on your side if the user has seen or subscribed to any of your campaigns, then you should add a global cookie.