With Advanced Ads Pro, you can display or hide an ad based on a cookie’s existence or value. Cookies are small pieces of information saved by different services in the visitor’s browser.
Table of Contents
There are multiple use cases on very advanced setups for this. Take a look at the examples below for some inspiration.
You don’t have to make any changes to display an ad everywhere. Only use this option to limit the visitors to which the ad is visible.
Cookie-based Ads
To use the cookie Visitor Condition, go to the Visitor Conditions meta box and add the Cookie condition.
There are three settings now.
Cookie name
The name of the cookie.
Operator
Choose from the available operators.
- contains/does not contain
- starts with/does not start with
- ends with/does not end with
- matches/does not match
- matches regex/does not match regex
Contains/does not contain
The entry to be checked does not have to contain the exact cookie value to be true, but a component of the cookie value is sufficient. If the borlabs-cookie
value is marketing-adsense
, a check for marketing
would be considered as true. as well as a check for ting
.
Starts with/does not start with
The entry to be checked must start with the same values as the cookie value to be true. If the cookie value is marketing-adsense
, a check for marketing
would be considered true as well as a check for mark
. A check for tin
would be false.
Ends with/does not end with
The entry to be checked must end with the same values as the cookie value to be true. If the cookie value is marketing-adsense
, a check for adsense
would be considered true as well as a check for sense
. A check for marketing
would be false.
Match/does not match
This operator checks whether the entered value exactly matches the value of the stored cookie or not.
If the cookie value is marketing-adsense
, a check for adsense
would be considered false. The only true result brings a check for marketing-adsense
.
The “match/does not match” operator brings another unique behavior. If you leave the field for the cookie value empty, Advanced Ads will check only the cookie’s existence, not the values. So if you want to check for the existence of the cookie borlabs-cookie
and not for specific values, leave the cookie values field of this condition blank.
Matches regex/does not match regex
Advanced Ads allows using regular expressions in the cookie condition which significantly expands the possibilities. For example, you could check the existence of one of several values in the borlabs-cookie
. Use, for example, the cookie value marketing|adsense|statistics
to check, if the cookie contains one of these terms.
Please don’t include any delimiters in the cookie value field like /marketing|adsense|statistics/
to ensure that the regex option works correctly.
You can test and adjust your regular expressions on sites like regex101.
Cookie value
The value of the cookie. Leave this field empty if you only want to check whether the cookie exists or not, but the value does not matter to you.
Examples for the cookie condition
I first used this condition to display a cookie consent message to visitors. In this tutorial, you can read all about how to display an EU Cookie Law compliant Info Message.
Ads based on Optin-Monster status
If you use the famous opt-in service Optin-Monster, you can use the cookie they set to display an ad if a user has already closed the subscribe form before. Or you can show another form, etc.
The default Optin-Monster cookie reads like om- + form ID, e.g., om-1256.
If the user closes the form, a cookie with this name will be set with the value true.
So, to display an ad or any other content to a visitor who has already closed the opt-in form with the id om-1256, you can use the following settings.
Known issues
- When using the Cookie condition combined with AJAX Cache Busting, cookies with a specific path are not working.