@fredvi I looked at the url you sent. A couple of things. The part of the code from https://stackoverflow.com/questions/63440572/how-to-display-or-block-personalized-adsense-ads-based-on-consent-for-iab-tcf-v2 where google tags should be added to the page is all commented out on your website, so my code (which waits for consent is not adding Google tags). Your Google ad tags are being added else where on page. Can you move the adding of your google tags into the insertAdsByGoogleJs() function?
*Also, there was a small bug in the code posted previously (since fixed) where I used “tcdata.vendor.consents” and “tcdata.purpose.consents” where it should be “tcData.vendor.consents” and “tcData.purpose.consents”. (I missed the capital D in data).
In this code snippet here (from stack overflow, with the incorrect variable names updated):
if ( ! tcData.gdprApplies ) {
// GDPR DOES NOT APPLY
// Insert adsbygoogle.js onto the page.
insertAdsByGoogleJs();
}
else {
// GDPR DOES APPLY
// Purpose 1 refers to the storage and/or access of information on a device.
var hasDeviceStorageAndAccessConsent = tcData.purpose.consents[1] || false;
// Google Requires Consent for Purpose 1
if (hasDeviceStorageAndAccessConsent) {
// GLOBAL VENDOR LIST - https://iabeurope.eu/vendor-list-tcf-v2-0/
// CHECK FOR GOOGLE ADVERTISING PRODUCTS CONSENT. (IAB Vendor ID 755)
var hasGoogleAdvertisingProductsConsent = tcData.vendor.consents[755] || false;
// Check if the user gave Google Advertising Products consent (iab vendor 755)
if(hasGoogleAdvertisingProductsConsent) {
// Insert adsbygoogle.js onto the page.
insertAdsByGoogleJs();
}
}
}
You are adding Google ad tags to your website without checking for consent. I