Google AdSense + Privacy banner = RESULT_CODE_HUNG
Google AdSense and Banners for GDPR/Privacy.
If you have a website and use Google Adsense to monetize your traffic, you probably know that for some time now Google has introduced an automatic cookie consent (GDPR) banner that appears at the bottom of the page when a user visits your site from a European Union country.
This banner is supposed to facilitate visitor consent management and privacy compliance, but in some cases it can cause compatibility problems with other elements on the page, such as automated ads from Google Adsense itself.
The incompatibility problem.
This is what happened to me on my site www.bugsdrivendevelopment.net, where I activated Google Adsense’s GDPR automated banner following the instructions provided by Google (which are always as clear and precise as Ikea’s instructions).
Everything seemed to work fine, until I noticed that some pages on my site would crash when I scrolled down, showing after a few minutes the error code RESULT_CODE_HUNG
on the browser (which is a fancy way of saying “I gave up").
I tried reloading the page, changing browsers, clearing the cache, but no dice: the problem persisted and made my site unusable (and my earnings from Google Adsense even more miserable).
I then decided to do some debugging
via the browser's developers console
, to try to figure out what was causing the page to crash (and if there was any way to blame anyone else).
The source of the problem.
I found that the problem was due to an incompatibility between Google Adsense’s GDPR automated banner feature and the automated ads set as anchored to the page. The banner feature to work uses a bottom left icon that dynamically appears when we approach the bottom of the page. At the same stempo, the automatic ads anchored to the page, especially at the bottom of the page, created a loop in the javascript
engine of the browser that got trapped bouncing between the listeners of one component and the other.
Basically, when the banner appeared at the bottom of the page, it conflicted with the fixed ads and created an endless loop that consumed all browser resources and caused it to crash.
The (trivial) solution.
The solution I found was to disable the automatic ads anchored to the page from the Google Adsense control panel, and leave only the ads in dynamic positions:
- from the main screen of Google AdSense go to Adverts
- click on the pencil icon to edit those on the offending web page.
- Overlay format.
- Disable anchored ads.
This way, the automatic GDPR banner no longer interferes with the ads and the page no longer crashes.
Obviously this solution may not be suitable for all sites and all needs, but in my case it worked and allowed me to solve the problem without giving up the automatic GDPR banner from Google Adsense (which is a very important thing for me and my lawyers).
I hope this experience will be useful to someone who is in the same situation and wants to prevent their site from crashing because of the automatic GDPR banner of Google Adsense.