With Advanced Ads Pro you can display or hide an ad based on the existence or the value of a cookie. Cookies are small pieces of information saved by different services in the visitor’s browser.
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 in order to display an ad everywhere. Only use this option if you want to limit the visitors to which the ad is visible.
To make use of the cookie visitor condition, go to the Visitor conditions metabox and add the cookie condition.
There are three settings now:
Select whether to show or hide the ad if the following conditions are true.
The name of the cookie.
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 in order to display a cookie consent message to visitors. You can read all about it in the tutorial How to display an EU Cookie Law compliant Info Message.
Ads based on Optin-Monster status
If you are using the famous opt-in service Optin-Monster then you can use the cookie they set to display an ad if a user already closed the subscribe form before. Or you can display another form, etc.
The default Optin-Monster cookie reads like “om-” + form ID, e.g. om-1256.
If the user closed the form then a cookie with this name is set with the value true.
So, in order to display an ad or any other content to a visitor who already closed the opt-in form with the id “om-1256” you can use the following settings.
- When you are using the Cookie condition in combination with AJAX cache-busting, cookies with a specific path are not working.
- The iThemes Security plugin does prevent cookies from working in AJAX calls, which would prevent this condition to work when AJAX cache-busting is enabled.