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.
Update on 2020-11-06 : Last clients that used this script have reported a drop of errors by 95% for Adsense.
Last updated