How to display or block personalized Adsense ads based on consent for IAB TCF v2.0 with Quantcast Choice?

I’ve chosen Quantcast Choice as the consent management platform for my website. However with their basic solution Google Adsense ads are still served to visitors before they give their consent for the related vendor (Google). Since 2 days there’s a notice in Adsense confirming this issue and after a grace period of 90 days no ads will be served anymore. The error message: "2.1a: the Tag or SDK isn’t receiving a TC string due to CMP status being stub, loading, or error."

I’m not familiar at all with scripts, but it seems I have to use some to make Quantcast Choice actually work.
Basically I need to know how to:

  • not serve any Google ads before a visitor consent to Google
  • serve personalized ads after consent
  • serve non-personalized ads after no consent

What I’ve learned so far:

Before a visitor’s consent, I can add this script to my Google Adsense code to not show any ads:

<script>(adsbygoogle=window.adsbygoogle||[]).pauseAdRequests=1;</script>

No problem so far. However then I should be able to know if a visitor has given consent for the vendor Google. Google’s vendor ID in the TCF v2.0 is 755. I found the following mixture of code and text on one of the Quantcast pages, but I don’t know how to use this. Should I put this on my webpages within the Quantcast Choice script or …? (source linked below)

{{QC - __cmpConsents.iabVendorConsentIds}} matches the regular expression (^|,)755(,|$).

So if ID 755 is found, I should call:

(adsbygoogle=window.adsbygoogle||[]).pauseAdRequests=0

and if ID 755 is not found, I should call:

(adsbygoogle=window.adsbygoogle||[]).requestNonPersonalizedAds=1
(adsbygoogle=window.adsbygoogle||[]).pauseAdRequests=0

But how do I do these "calls"?

So I think I understand the steps to follow, it’s just that I don’t know how to implement these steps and connect the dots. Any help would be much appreciated!

Sources I’ve used:

Example of a website that seems to do what I want to achieve: carscoops.com

43 thoughts on “How to display or block personalized Adsense ads based on consent for IAB TCF v2.0 with Quantcast Choice?”

Leave a Comment