I want an accurate picture of all the visitors landing on the website and converting. Unfortunately, the adblocker tools also block Google Analytics and Google Tag Manager, I am using the newer script

window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'my id here');

How do I prevent this from getting blocked by ad blockers and other tools. THIS article only shows how to unblock the previous version of the script

2 Answers 2


You can proxy the analytics request through your own domain, and obfuscate the telltale keywords regex-based adblockers key off. I wrote a very detailed article on this topic. As for opt-out, they should get a GDPR banner, and if they decline, they can leave your site. Simple as that.


I'm not a lawyer however I think it goes against the Analytics TOS to try and circumvent a user's choice/ability to opt-out of GA tracking. The GA TOS states the following under the 7.Privacy section:

You must not circumvent any privacy features (e.g., an opt-out) that are part of the Service. You will comply with all applicable Google Analytics policies located at www.google.com/analytics/policies/ (or such other URL as Google may provide) as modified from time to time (the "Google Analytics Policies")

You can find a list of the GA TOS for all countries on the following page

  • I'm not a lawyer either, but I don't think third-party adblockers form part of the "Service" offered by Google and referred to here. It's like trying to claim your garage door lock is part of your car's security features. It may have the effect of improving your car's security... but it's not a part of its security features.
    – Ned Martin
    Commented Mar 24, 2021 at 6:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.