How to show ads based on the cookie consent

This manual describes the options you have in Advanced Ads to show ads only to visitors who consent first. This feature works for any consent gathering method that uses a readable cookie to store the user’s choice.

You can find this option under Advanced Ads > Settings > Privacy

Important notices about these settings

If you enable the Privacy module and a consent method, Advanced Ads will hide all ads unless your visitors grant this consent. This means that upon activation, neither you nor any other user will see ads. 

Note: this setting can decrease your ad revenue.

Advanced Ads does not show a consent notice automatically. Below this tutorial, you will find information on integrating with other plugins or building your own using Advanced Ads.

Our privacy settings only work for ads managed with Advanced Ads, e.g., not (ad) codes you added directly to your site. On the other hand, you can use these options also to show or execute any other code that needs consent first.

If you are integrating a Consent Management Platform that supports TCF 2.2, you might want to look at the TCF 2.2 Consent Manual for WordPress.

Websites using Cache

On cached websites, you need Advanced Ads Pro with enabled cache busting to show ads dynamically based on the consent.

Plugin-wide settings

You can enable the Privacy module under Advanced Ads > Settings >  Privacy.

Privacy module Advanced Ads

Next, you need to choose the consent method. For now, you can check an existing cookie and its value. You will find a table with popular plugins and their corresponding values below this article.

Cookie consent options in Advanced Ads
Cookie consent options

You can use the Cookie option to show ads based on any cookie set. Advanced Ads will hide these ads until the users set this specific cookie. The cookie only needs to contain the value, not be an exact match. 

Note: the check needs a value for the cookie to work.

Show non-personalized AdSense ads

According to this AdSense page, you need to get consent for cookies and personalized ads for EU visitors.

Opinions about gathering consent for cookies vary from just informing your visitors to getting explicit consent. This is why we added an option to show non-personalized AdSense ads without permission.

This feature considers only AdSense ads you embed using the AdSense ad type, not the Plain text and code ad type.

Show non-personalized AdSense ads

It is your responsibility to decide whether to show AdSense without explicit consent or not. We might change this behavior in case AdSense demands us to.

You can follow this tutorial to verify if non-personalized ads are loaded.

Please note that you could also disable personalized ads for all EU visitors in your AdSense account. In that case, the option is not working. All EU visitors, those with and those without consent, would be seeing non-personalized ads only. 

Go to Allow & block ads > All my sites > EU user consent to change that setting.

Advanced Ads also integrates with the TCF 2.2 consent framework. Here, you can find a detailed manual about how to set up Advanced Ads for TCF 2.2.

These are the ad types in Advanced Ads that are automatically waiting for consent before showing up. You can disable this behavior for some ad types.

  • Plain text and code
  • Rich Content
  • AdSense ad
  • Google Ad Manager
  • Auto ads enabled through Advanced Ads > Settings > AdSense

Image ads don’t need consent unless the Custom Code option that comes with Advanced Ads Pro is enabled and filled.

You can make an exception for individual ads. A common use case is custom HTML ads that don’t load code from another URL. Go to the ad edit screen of the relevant ad and enable the Ignore general Privacy settings checkbox in the Ad Parameters box.

Optional exceptions from the cookie consent settings for individual ads
Optional exceptions from the global consent settings for individual ads

This option only shows up if you have the Privacy module enabled, and consent for this particular ad type is optional. I.e., image ads only show this option if the Custom Code field that comes with Advanced Ads Pro is filled. AdSense ads never show the opt-out option because AdSense always needs consent to load.

Create a fallback ad

If you want to fill ad space until a user gives consent, use the opt-out option above for a fallback ad described in this tutorial.

Integrating with other plugins

Our consent method is flexible enough to work with a lot of plugins and other consent-gathering solutions. Below, you can find a list of some of them and what to enter in the options.

PluginCookie NameCookie Value
Borlabs Cookies 1.XborlabsCookie,all – all cookies are accepted
first-party – only first-party cookies
Borlabs Cookies 2.Xborlabs-cookieplease find the detailed instructions below
Complianz 5.Xcmplz_consent_statusallow
Complianz 6.Xcmplz_marketing allow
Cookie Consent by Catapult_ThemescatAccCookies1
Cookiebot | GDPR/CCPA Compliant Cookie Consent and ControlCookieConsentmarketing:true
CookieFirstcookiefirst-consent\”advertising\”:true
Cookie Notice by dFactorycookie_notice_acceptedtrue
CookieProOptanonConsent 0004:1 (1=accepted)
GDPR Cookie Consentviewed_cookie_policyyes
GDPR Cookie Compliancemoove_gdpr_popupthirdparty
CookieYescky-consent (or cookieyes-advertisement)yes
Quantcast Choiceeuconsentthe plugin generates a very long string that contains something like “[…] BOzOg5COzOg5CAKAABENDJ-AAAAvhr […]”
WP GDPR Compliancewpgdprc-consent-CONSENTVERSION
with CONSENTVERSION being increased every time you reset or update the cookie bar
accept – all cookies are accepted
1,2,4 – (just an example) consent IDs separated by commas
Names and values of different GDPR cookie consent solutions for WordPress

You can also build your own cookie consent message for WordPress using this tutorial.

Do you need a more advanced cookie check? Use our ad-specific Cookie condition instead of the privacy settings above.

Integrating with Borlabs Cookies 2.x

Borlabs Cookies 2.x is entirely different from version 1.x. The cookie name changed, and the value now contains the IDs of the cookie groups and cookies. You can use any of those to decide when Advanced Ads should show ads.

For example:

  • users should see ads when they accepted the Marketing group, then enter marketing in the cookie value field in Advanced Ads
  • users should see ads when they give the Google AdSense cookie consent, then enter google-adsense in the cookie value field in Advanced Ads
cookie-based ad condition
Example: settings to show an ad unit only when the cookie group “marketing” is accepted

If you use the privacy feature of Advanced Ads and embed AdSense ads on your website, please disable the AdSense cookie from Borlabs in Dashboard > Borlabs Cookie > Cookies.

Tip: If you have an active All Access license, you can find a discount for Borlabs in the Deals section of your account.

Disabling the AdSense integration from Borlabs Cookie
Disable the AdSense cookie in Borlabs if you use the privacy function of Advanced Ads

Integrating with Complianz

Complianz saves two different cookies that you can use to show ads after consenting. Depending on the version you are using the cookies are complianz_consent_status for version 5 and cmplz_marketing for Complianz 6. Both cookies are saved with the value allow when consent is given.

Please don’t connect Complianz with Google Ads/DoubleClick in Dashboard > Complianz > Integrations to avoid issues.

Google Ads connection in Complianz
Google AdSense option in the Complianz settings

Besides the mentioned cookies, the Pro version of Complianz also supports the TCF 2.2 standard. Here you can find a manual about how to integrate TCF 2.2 using Advanced Ads.

Tip: If you have an active All Access license, you can find a discount for Complianz Premium in the Deals section of your account.

Integrating with other services

Didomi

If you are using Didomi as a consent management tool, then you must rewrite the ad codes managed by Advanced Ads as described here.

Known issues

  • Like all solutions that show different ads to different users, this can show the wrong ads if the website uses caching. Our cache busting solves that. Our tests also showed that WP Rocket handles this well.
  • The non-personalized-ads for AdSense option doesn’t work for Auto ad codes added manually to the website (and not through our AdSense settings)
  • When you enabled the module and consent method but didn’t consent, you will see a warning in the Ad Health section in the frontend. It is not an issue but might irritate you. Don’t worry. Only you see this warning, which helps debug why ads might not appear. The warning disappears if you gave your consent.
  • This feature does not work on AMP yet, because the Google AMP bot might cache the status without ads and not show any at all. We will address this as soon as the cookie plugins we integrate with support AMP as well.
  • Cookie values including special characters like single quote ('), double quote ("), ad backslash (\) need escaping with \ so the privacy feature can read the value. Example: value in the cookie is "ads" correct value to enter in the plugin: \"ads\".

Subscribe to our newsletter and get 2 add-ons for free!

* indicates required
Interests

Resources

Make it better

Increase your ad management skills without spending more time.
Join over 150,000 publishers and AdOpts increasing their ad revenue.