Plugin Contributor
Ryan
(@rbaronqc)
@vsharmilee i see https://quantcast.mgr.consensu.org/tcfv2/cmp2.js being added twice, maybe choice is being added via Google Tag Manager and the Plugin? This is likely cause the issue of the CMP not showing. The GTM tutorial you followed also includes the Choice Tag. In GTM under Tags can you see if you have one called QC – Universal Tag + Choice TCFv2 with CCPA and DL push, and if so remove it (assuming you leave the Choice plugin installed (which is what I recommend))
No I havent installed Google Tag Manager , Choice is added only through the QC plugin.
I am not sure how it is added twice.
I have added universal tag id(JKzBHCSncuaPA) in TCFV 2.0 Settings page and also added the universal tag code(full script) in the website header manually in wordpress.Is this correct? Please advise.
Plugin Contributor
Ryan
(@rbaronqc)
@vsharmilee I see the issue. You force traffic to non www (that is totally fine) but in the browser developer console when I do window.location.host the value returns with www. From the perspective of choice http://www.example.com is different than example.com, just like help.example.com is different. So in the dashboard you registered your site like ‘example.com’ and your website is requesting data for your site like ‘www.example.com’. See my answer here for the solution https://ww.wp.xz.cn/support/topic/google-error-code-2-1a/#post-13263023
Thank you! Now I have changed to www and I can see the QC consent popup finally.Since I can see the consent popup being loaded before the ads, will this solve the 2.1a issue?
Hello,
I’ve tried to setup the Quantcast Choice consent via plugin and directly in the code. I always get the error 2.1a in my adsense account. From what i’ve read the problem is that the ads are being show before the user consent. What can I do for the ads to be shown only after user consent?
My google adsense tags are directly in the code. The quantcast tag is the first one after the <head>. You can check my site: https://estudos.com.pt
Thanks for your help.
@rbaronqc
Yes, always busy…
Ad Inserter can check for value/property in the cookie (euconsent-v2 cookie is used by Quantcast Choice) and if the value is not present then the ad code is not inserted.
Of course, you need to configure the plugin to do this.
What value/property needs to be checked?
Or if I ask differently, what value/property in the cookie is present when the consent is given?
Hi @rbaronqc,
any idea why this js error comes out sometimes in console?

I’m not using the plugin by the way, but installed the code manually.
ex url:
www . notizie . it/politica/2020/08/16/discoteche-chiuse-italia/
Plugin Contributor
Ryan
(@rbaronqc)
@lolesdotpt If you are adding tags directly in the head you will likely need to do something like this: (this is untested, I just put it together as a guide to help)
( function() {
// Run this in an interval (every 0.1s) just in case we are still waiting
var cnt = 0;
var consentSetInterval = setInterval(function(){
cnt += 1;
// Bail if we have not gotten a consent response after 30 seconds.
if( cnt === 300 )
clearInterval(consentSetInterval);
if( typeof window.__tcfapi !== 'undefined' ) { // Check if window.__tcfapi has been set
clearInterval( consentSetInterval );
window.__tcfapi( 'addEventListener', 2, function( tcData,listenerSuccess ) {
if ( listenerSuccess ) {
// Uncomment this console.log to view the selected consent choices, for iab vendors, in the developer console.
console.log( 'tcData', tcData );
if( tcData.eventStatus === 'tcloaded' || tcData.eventStatus === 'useractioncomplete' ) {
if ( ! tcData.gdprApplies ) {
// GDPR DOES NOT APPLY, ALL TAGS IAB and NON IAB CAN BE ADDED HERE.
// NO GDPR - FREE TO ADD ALL COOKIES HERE.
// NO GDPR - FREE TO ADD ALL COOKIES HERE.
// NO GDPR - FREE TO ADD ALL COOKIES HERE.
// NO GDPR - FREE TO ADD ALL COOKIES HERE.
}
else {
// GDPR DOES APPLY, USE CONSENT VALUES IN tcData TO DETERMINE WHICH TAGS CAN BE ADDED ON THE SITE.
// GLOBAL VENDOR LIST - https://iabeurope.eu/vendor-list-tcf-v2-0/
// GOOGLE ADVERTISING PRODUCTS IAB VENDOR ID == 755
// Add logic here to determine what tags can be added based on the user consent data in 'tcData'
// and add the tag where you have proper consent
// ...
// ...
// ADDITIONAL NON-IAB VENDORS (IF YOU HAVE NON IAB VENDORS ADDED)
// Non IAB vendors need to be added manually here https://www.quantcast.com/protect/vendors (under the non-iab vendors tab)
// - Non-IAB vendors and ID will differ per site as they are not part of the Global Vendor List and added bespoke per site.
window.__tcfapi( 'getNonIABVendorConsents',2, function( nonIabConsent, nonIabSuccess ) {
// ** NOTE: We are still inside else statement (from above) indicating that GDPR Applies, which means
// we need to check for consent for Non-IAB vendors before adding tags to the site.
if ( nonIabSuccess ) {
if ( nonIabConsent.hasOwnProperty( 'nonIabVendorConsents' ) && null !== nonIabConsent.nonIabVendorConsents ) {
// Uncomment this console.log to view the selected consent choices, for non iab vendors, in the developer console.
console.log( 'nonIabConsent', nonIabConsent );
// Add your logic here to determine what tags can be added based on the user consent data in 'tcData'
// and add the tag where you have proper consent
// ...
// ...
}
}
} );
}
}
}
} );
}
cnt++;
}, 100);
})();
This might also be helpful: https://github.com/InteractiveAdvertisingBureau/GDPR-Transparency-and-Consent-Framework/blob/master/TCFv2/IAB%20Tech%20Lab%20-%20CMP%20API%20v2.md#addeventlistener
@rbaronqc I’m sorry, i’m not a developer… What am I supposed to do with that code? Is there an easier way to get the ads shown only after the consent?
I’ve found this thread that explains well the problem we are facing:
https://stackoverflow.com/questions/63440572/how-to-display-or-block-personalized-adsense-ads-based-on-consent-for-iab-tcf-v2
Thank you
@rbaronqc I don’t know coding and am not sure of the workaround to fix the consent loading before the ads.Looking for a step by step instruction guide to fix this.
@rbaronq Could you give us more details about where to insert that script?. Thanks.
Plugin Contributor
Ryan
(@rbaronqc)
Hi @marlaskas, are you comfortable editing your theme code? We will work on better docs for this, but hopefully this helps. You should just be able to add that JavaScript to your website theme like you would any other JS. Either add it to your existing js file, or add a new .js file to your theme and include that file with wp_enqueue_script (This file has NO dependancies) You could also drop it directly in your <head><script>Add the code here</script></head> (but that is not very wordpressy). Does that help?
Hello @rbaronqc
I added the script you sent before the </head> tag but I still see ads before giving consent. Can you please check my website https://estudos.com.pt
Thank you
Plugin Contributor
Ryan
(@rbaronqc)
@lolesdotpt I can see you added the script to the site, but that script I posted needs some modifications and was only meant be a starting place. If you look at the code there are a few comments like “// Add logic here to determine what tags can be added based on the user consent data in ‘tcData'” where the code needs modifications base on the tags you want to add and the consent you need.
Plugin Contributor
Ryan
(@rbaronqc)
@drlightman can you start a separate thread, that seems to be a different issue.