• Resolved fredvi

    (@fredvi)


    Hi team,

    thanks to your work, i have some trouble. i setup all the tag in my header and my footer. I used your code stackoverflow.com but my ads don’t display after i clicked on button accept on TCF. i don’t understand why.

    can you have an idea ?

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor Ryan

    (@rbaronqc)

    @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

    Thread Starter fredvi

    (@fredvi)

    wahou thanks a lot, all it’s good.

    My google tags was above the menu but was blocked. I changed your little tcData and all it’s good.

    Thanks a lot to your help.

    Plugin Contributor Ryan

    (@rbaronqc)

    @fredvi nice work! I just tested and working as expected.

    Hi,

    I also added this code into my blog and now i have on my console the following error:

    Uncaught SyntaxError: missing : after property id

    At line 226:6
    => cnt += 1;

    Any ideas?

    Toengel@Alex

    https://toengel.net/philipsblog/

    • This reply was modified 4 years, 3 months ago by Toengel.
    Thread Starter fredvi

    (@fredvi)

    Hi Toengel,

    you are a missing close ) in prev line :

    you are :

    var consentSetInterval = setInterval(function(

    instead of :

    var consentSetInterval = setInterval(function()

    i hope it’s help

    Hi,

    thanks – it worked!

    Toengel@Alex

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘google adsense display’ is closed to new replies.