Title: Google Error Code 2.1a
Last modified: August 15, 2020

---

# Google Error Code 2.1a

 *  Plugin Contributor [Ryan](https://wordpress.org/support/users/rbaronqc/)
 * (@rbaronqc)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/google-error-code-2-1a/)
 * 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](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](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](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 5 years, 8 months ago by [Ryan](https://wordpress.org/support/users/rbaronqc/).
    -  This topic was modified 5 years, 8 months ago by [Ryan](https://wordpress.org/support/users/rbaronqc/).

Viewing 15 replies - 31 through 45 (of 81 total)

[←](https://wordpress.org/support/topic/google-error-code-2-1a/page/2/?output_format=md)
[1](https://wordpress.org/support/topic/google-error-code-2-1a/?output_format=md)
[2](https://wordpress.org/support/topic/google-error-code-2-1a/page/2/?output_format=md)
3 [4](https://wordpress.org/support/topic/google-error-code-2-1a/page/4/?output_format=md)
[5](https://wordpress.org/support/topic/google-error-code-2-1a/page/5/?output_format=md)
[6](https://wordpress.org/support/topic/google-error-code-2-1a/page/6/?output_format=md)
[→](https://wordpress.org/support/topic/google-error-code-2-1a/page/4/?output_format=md)

 *  [sneesel](https://wordpress.org/support/users/sneesel/)
 * (@sneesel)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/google-error-code-2-1a/page/3/#post-13270791)
 * Hi, I’m a Spanish Native Speaker, I’m sorry for bothering you.
 * I want to know if this could works like a Cookies Consent Plugin? I mean, I have
   the error 2.1a and I installed quancast choice to see if the error dissapear.
   But It is still on the platform, probably it could be dissapear later.
 * So, at this moment I have configurated my site for GRPD, (Privacy) and I deactivated
   another cookies plugin, so I only left Quantcast Activated.
 * This will solve the 2.1a error? I followed the video instructrions and activated
   the TCF v2.0 settings.
 * Can I also change the mobile theme? I mean, it will appear on 95% of the screen,
   which is a little uncomfortable see this: [https://i.ibb.co/pjw8V3W/cookies.jpg](https://i.ibb.co/pjw8V3W/cookies.jpg)
 * I sent a contact message so you can help me privately.
 * Tell me if I’m wrong asking for help here, and hope you all have a GREAT WEEK!
 *  Plugin Contributor [Ryan](https://wordpress.org/support/users/rbaronqc/)
 * (@rbaronqc)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/google-error-code-2-1a/page/3/#post-13270966)
 * [@sneesel](https://wordpress.org/support/users/sneesel/) the problem likely lies
   with the way you add your google tags/cookies, not with the CMP. So you will 
   likely see this message regardless of the CMP you choose, but we do hope you 
   choose Choice. Yes, there are lots of custom display options see the help center
   guides here [https://help.quantcast.com/hc/en-us/sections/360006841354-Setup](https://help.quantcast.com/hc/en-us/sections/360006841354-Setup),
   including a smaller (bottom of the page display option). But back to the problem
   at hand. What is happening is that BEFORE a website visitor sets their consent
   choices your website has already added google tags (i.e. 2.1a errors). I don’t
   know how you are adding your Google tags to your website (as this differs from
   site to site) but wherever that add is happening, it is not checking to see if
   you have consent before adding.
 *  [sneesel](https://wordpress.org/support/users/sneesel/)
 * (@sneesel)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/google-error-code-2-1a/page/3/#post-13271271)
 * Hi, thanks for your quickly answer.
 * Yeah I will use the CPM that gives me the most fast solution, in this case Quantcast.
 * I am using newspaper theme, so I am putting my ads partners on ads.txt and also
   on the system advertising dashboard but only the script (tagdiv-composer).
 * I sent an email to get privately help, hope you can help me just in case, let
   me give you my site [http://www.musicmundial.com](http://www.musicmundial.com)
   so you can check, and sorry if it’s not allowed to put urls here.
 * And for mobile smaller bar, I tried to find out it, but I didn’t get the way 
   to change it. Can you send me a direct link to solve this issue?
 * Best regards.
    -  This reply was modified 5 years, 8 months ago by [sneesel](https://wordpress.org/support/users/sneesel/).
 *  [lolesdotpt](https://wordpress.org/support/users/lolesdotpt/)
 * (@lolesdotpt)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/google-error-code-2-1a/page/3/#post-13271346)
 * Hello [@rbaronqc](https://wordpress.org/support/users/rbaronqc/),
 * I’m not getting what the issue is then. I followed the instructions: In the header
   I placed Quantcast Choice universal tag.
 * My ads are placed according google adsense instructions, put the following code
   where I want the ad to appear:
 * <script async src=”[https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js”></script&gt](https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js”></script&gt);
   
   <!– site xyz –> <ins class=”adsbygoogle” style=”display:block” data-ad-client
   =”ca-pub-XXXXXXXXXXXXXXX” data-ad-slot=”XXXXXXXXX” data-ad-format=”auto” data-
   full-width-responsive=”true”> <script> (adsbygoogle = window.adsbygoogle || []).
   push({}); </script>
 * What’s wrong then?
 * Somehow this website [https://www.carscoops.com/](https://www.carscoops.com/)
   seems to get the things work without problems, the ads are only show after consent
   and it seems they are using Quantcast Choice also.
 * Best regards,
 *  [lolesdotpt](https://wordpress.org/support/users/lolesdotpt/)
 * (@lolesdotpt)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/google-error-code-2-1a/page/3/#post-13271434)
 * Any ideia on how to adapt this code to work with Quantcast?
 *     ```
       <html>
       <head>
       <title>Your site title</title>
       </head>
       <body>
   
       <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
       <script>(adsbygoogle=window.adsbygoogle||[]).pauseAdRequests=1;</script>
       // This will pause ad requests, so users have time to interact with your consent solution.
   
       /* Set up the consent solution and act according to the user choice. 
   
       If the user declines personalized ads, make sure to call (adsbygoogle=window.adsbygoogle||[]).requestNonPersonalizedAds=1;
       Remember that you need user consent for using cookies even for non-personalized ads in countries where the EU eprivacy directive requires it.
   
       Later, you can call (adsbygoogle=window.adsbygoogle||[]).pauseAdRequests=0 to resume sending ad requests. Without making this call, no ads will be shown.
   
       */
   
       <!-- One test unit for GDPR -->
       <ins class="adsbygoogle"     style="display:inline-block;width:970px;height:250px"
            data-ad-client="ca-pubxxx"
           data-ad-slot="slot_id">
       </ins>
   
       <!-- Another test unit for GDPR -->
       <ins class="adsbygoogle"     style="display:inline-block;width:250px;height:250px"
            data-ad-client="ca-pubxxx"
           data-ad-slot="slot_id">
       </ins>
       <script>(adsbygoogle = window.adsbygoogle || []).push({});</script>
       // This usually triggers the ad request, but you have paused these.
   
       </body>
       </html>
       ```
   
 * Source: [https://support.google.com/adsense/answer/9042142](https://support.google.com/adsense/answer/9042142)
 *  Plugin Contributor [Ryan](https://wordpress.org/support/users/rbaronqc/)
 * (@rbaronqc)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/google-error-code-2-1a/page/3/#post-13271711)
 * [@lolesdotpt](https://wordpress.org/support/users/lolesdotpt/) working on something
   now, please stand by…
 *  Plugin Contributor [Ryan](https://wordpress.org/support/users/rbaronqc/)
 * (@rbaronqc)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/google-error-code-2-1a/page/3/#post-13271792)
 * [@lolesdotpt](https://wordpress.org/support/users/lolesdotpt/) I have **NOT tested**
   this but I believe this is what you would need to do for AdSense.
 *     ```
       <html>
         <head>
           <title>Your site title</title>
         </head>
         <body>
   
           <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
           <script>
             // Initially pause adsbygoogle (wait for consent to unpause)
             (adsbygoogle=window.adsbygoogle||[]).pauseAdRequests=1;
           </script>
   
           <script>
             ( function() {
               // Run this in an interval (every 0.1s) just in case we are still waiting for consent
               var cnt = 0;
               var consentSetInterval = setInterval(function(){
                 cnt += 1;
   
                 // Bail if we have not gotten a consent response after 60 seconds.
                 if( cnt === 600 )
                   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 ) {
                       if( tcData.eventStatus === 'tcloaded' || tcData.eventStatus === 'useractioncomplete' ) {
                         if ( ! tcData.gdprApplies ) {
   
                           // GDPR DOES NOT APPLY, UnpauseAdRequests
   
                           // Set non-personalized ads to false.
                           (adsbygoogle=window.adsbygoogle||[]).requestNonPersonalizedAds=0;
   
                           // Unpause ads , the user has granted consent for purpose 1 and given google consent.
                           (adsbygoogle = window.adsbygoogle || []).pauseAdRequests=0;
   
                         }
                         else {
   
                           // GDPR DOES APPLY
   
                           // Purpose 1 refers to the storage and/or access of information on a device.
                           var hasDeviceStorageAndAccessConsent = tcdata.publisher.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) {
                               var hasPersonalizedProfileConsent = tcdata.publisher.consents[3] || false;
                               var hasPersonalizedAdsConsent = tcdata.publisher.consents[4] || false;
   
                               // Check if have add personalization consent Purpose 3 and 4
                               if( hasPersonalizedAdsConsent && hasPersonalizedProfileConsent ) {
                                 // Set non-personalized ads to false.
                                 (adsbygoogle=window.adsbygoogle||[]).requestNonPersonalizedAds=0;
                               }
                               else {
                                 // Set non-personalized ads to true.
                                 (adsbygoogle=window.adsbygoogle||[]).requestNonPersonalizedAds=1;
                               }
   
                               // Unpause ads , the user has granted consent for purpose 1 and given google consent.
                               (adsbygoogle = window.adsbygoogle || []).pauseAdRequests=0;
                             }
                           }
                         }
                       }
                     }
                   } );
                 }
                 cnt++;
               }, 100);
             })();
           </script>
   
           <!-- One test unit for GDPR -->
           <ins class="adsbygoogle"
                style="display:inline-block;width:970px;height:250px"
                data-ad-client="ca-pubxxx"
                data-ad-slot="slot_id">
           </ins>
   
           <!-- Another test unit for GDPR -->
           <ins class="adsbygoogle"
                style="display:inline-block;width:250px;height:250px"
                data-ad-client="ca-pubxxx"
                data-ad-slot="slot_id">
           </ins>
   
           <script>
             // This will trigger the ad request if ads were unpaused in the CMP consent check above.
             (adsbygoogle = window.adsbygoogle || []).push({});
           </script>
   
         </body>
       </html>
       ```
   
 *  [sneesel](https://wordpress.org/support/users/sneesel/)
 * (@sneesel)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/google-error-code-2-1a/page/3/#post-13271807)
 * I think I have the same problem that [@lolesdotpt](https://wordpress.org/support/users/lolesdotpt/),
   I put the scripts on my site, and also I put the code on my head but it looks
   like not working. If you can be gentle and see my site I will be so grateful.
 * Another question, If I have 2 cms (an spanish and english version but with 2 
   wordpress) Do I need to put the code in both <head>? right?
 * Thank you so much!
 *  Plugin Contributor [Ryan](https://wordpress.org/support/users/rbaronqc/)
 * (@rbaronqc)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/google-error-code-2-1a/page/3/#post-13271822)
 * [@sneesel](https://wordpress.org/support/users/sneesel/) if you use the WordPress
   plugin you DO NOT need to manually add the Quantcast tag to your site. The plugin
   is already doing that for you.
 *  Plugin Contributor [Ryan](https://wordpress.org/support/users/rbaronqc/)
 * (@rbaronqc)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/google-error-code-2-1a/page/3/#post-13271865)
 * [@lolesdotpt](https://wordpress.org/support/users/lolesdotpt/) I posted a comment
   with solution based off of your adsense example, but then I made an edit to it
   and now it is being held in moderation until it is manually reviewed. I also 
   posted the code on [stackoverflow](https://stackoverflow.com/questions/63440572/how-to-display-or-block-personalized-adsense-ads-based-on-consent-for-iab-tcf-v2/63455447#63455447)
   as well in case you don’t want to wait for that comment to become unblocked.
 *  [sneesel](https://wordpress.org/support/users/sneesel/)
 * (@sneesel)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/google-error-code-2-1a/page/3/#post-13272042)
 * Hi rbaronqc thanks for helping us!
 * Okey, I deleted the code of my head, but I noticed you sent a code to another
   user that have the SAME problem that me.
 * What should I do? I’m not an expert so please help me with that.
 * I’m using newspaper theme so I put the ad “custom code” on the post theme. Should
   I paste that code on my site? or the plugin will help me and I dont need to do
   changes?
 * Thank you so much, and my apogologizes for taking a lot of your time.
 *  Plugin Contributor [Ryan](https://wordpress.org/support/users/rbaronqc/)
 * (@rbaronqc)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/google-error-code-2-1a/page/3/#post-13272073)
 * [@sneesel](https://wordpress.org/support/users/sneesel/) I still see Choice scripts
   being called twice on the site, if you are using this plugin [https://wordpress.org/plugins/quantcast-choice/](https://wordpress.org/plugins/quantcast-choice/)
   then you do NOT need to add the Choice tag manually to your site. The plugin 
   adds the tag for you. If you added your Qantcast universal tag to the theme custom
   code in addition to installing and activating this plugin remove one of the two
   methods. I would suggest keeping the plugin installed and removing the quantcast
   tag you added manually.
 *  [sneesel](https://wordpress.org/support/users/sneesel/)
 * (@sneesel)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/google-error-code-2-1a/page/3/#post-13272119)
 * Hi again, thanks.
 * Yeah, I did that, I only left the plugin activated and deleted the code from 
   the head section.
 * At the moment I think it is not working correctly with adsense.
 * How can I verify that? Visiting the website with incognito mode? Because my site
   doesn’t work like [https://www.carscoops.com](https://www.carscoops.com) and 
   I still having the warning on my adsense dashboard.
 * Also please send me a direct link to mobile smaller bar, thank you so so much
   for your help!
 *  Plugin Contributor [Ryan](https://wordpress.org/support/users/rbaronqc/)
 * (@rbaronqc)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/google-error-code-2-1a/page/3/#post-13272643)
 * ^^FIXING ISSUE WITH THE EXAMPLE CODE ABOVE^^
 * [@here](https://wordpress.org/support/users/here/) [@lolesdotpt](https://wordpress.org/support/users/lolesdotpt/)
   found a issue with the consent values I am checking in the example code above.
   In the code above, were I use tcdata.publisher.consents[1], tcdata.publisher.
   consents[3], tcdata.publisher.consents[4], those should be replaced with tcdata.
   purpose.consents[1], tcdata.purpose.consents[3], tcdata.purpose.consents[4].
 *  [DrLightman](https://wordpress.org/support/users/drlightman/)
 * (@drlightman)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/google-error-code-2-1a/page/3/#post-13273919)
 * > [@drlightman](https://wordpress.org/support/users/drlightman/) can you start
   > a separate thread, that seems to be a different issue.
 * I isolated the issue as caused by a bad implementation by a third party banner(
   not Adsense), so I’ve contacted them directly.
 * As for all these issues with Adsense, shouldn’t be Adsense which should interface
   itself with the CMP via __tcfapi in order to decide to show adunits or not? Having
   to parse pourposes and vendors manually doesn’t seem something reasonable to 
   do.

Viewing 15 replies - 31 through 45 (of 81 total)

[←](https://wordpress.org/support/topic/google-error-code-2-1a/page/2/?output_format=md)
[1](https://wordpress.org/support/topic/google-error-code-2-1a/?output_format=md)
[2](https://wordpress.org/support/topic/google-error-code-2-1a/page/2/?output_format=md)
3 [4](https://wordpress.org/support/topic/google-error-code-2-1a/page/4/?output_format=md)
[5](https://wordpress.org/support/topic/google-error-code-2-1a/page/5/?output_format=md)
[6](https://wordpress.org/support/topic/google-error-code-2-1a/page/6/?output_format=md)
[→](https://wordpress.org/support/topic/google-error-code-2-1a/page/4/?output_format=md)

The topic ‘Google Error Code 2.1a’ is closed to new replies.

 * ![](https://ps.w.org/quantcast-choice/assets/icon-256x256.png?rev=1879905)
 * [Quantcast Choice](https://wordpress.org/plugins/quantcast-choice/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/quantcast-choice/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/quantcast-choice/)
 * [Active Topics](https://wordpress.org/support/plugin/quantcast-choice/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/quantcast-choice/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/quantcast-choice/reviews/)

 * 81 replies
 * 19 participants
 * Last reply from: [blueann](https://wordpress.org/support/users/blueann/)
 * Last activity: [5 years, 6 months ago](https://wordpress.org/support/topic/google-error-code-2-1a/page/6/#post-13646353)
 * Status: not a support question