• Plugin Contributor Ryan

    (@rbaronqc)


    This topic is intended to help anyone address Google 2.1a errors.

    2.1a – If you are seeing this error code it is likely that you are loading Google tags before receiving are response form Choice with the users consent string and you will likely have to make some updates to prevent your tag from loading before Consent is known.

    I created a video here https://vimeo.com/448116970/4d24c9edc9 (apologies for the slow/jerky load in the video here, running over a VPN) which demonstrates expected behavior that shows ad tags that wait for consent to be established on page load before being added to the page. On subsequent page loads (user consent is saved) Choice popup will not show and ads will load using consent set in the previous Choice popup interaction.

    To test, in an incognito window, open your site to a page with ads. When you visit the page you should see Choice (i.e. consent has not been established as this is a first visit in incognito mode). At this point you should not see ads attempting in load in the background. You should not see any ads load/attempt to load. Once you agree and close the Choice popup all of you ads should begin to load without 2.1a issues.

    Solving 2.1a issues can be a rather difficult problem to solve due to the number of different ways tags can be added to websites. We are working to provide more detailed guides & examples to help you solve this error depending upon your setup.

    Quantcast Choice Plugin & Google Tag Manager:
    – 1. Adding Choice with the WordPress plugin and using the “send consent signals to the data layer” plugin option.
    – 2. Adding other third party tags with Google Tag Manager after reading consent signals from the data layer. If you implement the IAB Consent and Non-IAB Consent variables from this guide here https://help.quantcast.com/hc/en-us/articles/360052555693 you can now read the consent data, in GTM, that was passed to the data layer by Quantcast Choice and use those consent signals in GTM to create trigger events & trigger groups as shown here: https://help.quantcast.com/hc/en-us/articles/360051794434-TCF-v2-GTM-Implementation-Guide-IAB-Vendor-Tag-Blocking to prevent tags from firing until consent is established.

    • This topic was modified 4 years, 3 months ago by Ryan.
    • This topic was modified 4 years, 3 months ago by Ryan.
Viewing 15 replies - 16 through 30 (of 81 total)
  • 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 https://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://www.ads-software.com/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.

Viewing 15 replies - 16 through 30 (of 81 total)
  • The topic ‘Google Error Code 2.1a’ is closed to new replies.