Skip to main content

Fixing Google errors 2.1a

Google as vendor of the TCF, must wait for the CMP to trigger ad request.

But until now, they don't wait for the user consent and throw ad request even if the user is still exposed to the CMP. This is how 2.1a errors come up.


Adsense

Just add this piece of code in your body

<script type="text/javascript">
(adsbygoogle=window.adsbygoogle||[]).pauseAdRequests=1;
__tcfapi('addEventListener', 2, function(tcData, success) {
if (success && tcData.gdprApplies && (tcData.eventStatus === 'tcloaded' || tcData.eventStatus === 'useractioncomplete') ) {
(adsbygoogle=window.adsbygoogle||[]).pauseAdRequests=0;
__tcfapi('removeEventListener', 2, () => {}, tcData.listenerId);
}
})
</script>

1 - This script will ask Adsense to put on hold adrequest until the cmp collect the consent.

2- After user gave consent, ad requests are fired and ads are displayed.

You should see error 2.1a decreasing quickly. If it not the case, drop us an email to support@sfbx.io.

info

Google reports show errors aggregated on 7 days so you need to compare to the sum of Ad calls on the same period if you want to calculate a ratio.

Update on 2020-11-06 : Last clients that used this script have reported a drop of errors by 95% for Adsense.

info

Due to the way all advertising stack are built, it's virtually impossible to get a "zero" errors for the 2.1a errors .

Here is some organic cause of errors :

  • Adblockers

  • Slow internet bandwidth

  • Beta version of browsers

  • ...