-
Notifications
You must be signed in to change notification settings - Fork 104
Fix Web GUI breaking with ad blockers #560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Fixes web gui breaking with ad blockers (e.g. uBlock Origin)
The problem with this is that this is just a band-aid fix. If the pattern catches on and blockers add the new filename to the blocklists, it will break again. And we can continue eternally renaming. Wouldn't another approach that defines gtag to be null or some empty shim object that exposes the right functions but does nothing, be a more stable fix here, instead? |
That's true, I just wanted to keep the solution simple. A more stable fix would be to define Lines 49 to 69 in 8a6c4c4
The only downside is the shim definition would have to be copypasted before every inclusion of But this approach should be very resilient to ad blockers. Technically uBlock is capable of blocking inline scripts containing a given string (with the |
This reverts commit 9d692ea.
Better fix for the ad blocker incompatibility
Realized there's a cleaner solution. If |
I use AdBlock, which relies on EasyList, which you have also referred to, @andocz. |
I referred to EasyPrivacy, not EasyList. AdBlock Plus doesn't use that one by default, but has an option to use it. Not sure about regular AdBlock. Edit: Just checked and AdBlock has the option too. |
Yeah, the URL made the confusion ( easylist.to/easylist/ easyprivacy.txt). I managed to reproduce the issue by adding EasyPrivacy to AdBlock. |
Ad blockers using the EasyPrivacy filter list (e.g. uBlock Origin with the default configuration) block
/scripts/ga.js
from loading. When this happens,gtag
never gets defined, which breaks much of the Web GUI's code, as it's full ofif (gtag) {
statements.As a result, features like Git Blame and the diagrams don't work at all. This can be currently seen on codecompass.net's demo -
Uncaught ReferenceError: gtag is not defined
appears in the log when trying to use these features.The demo on zolix.hu doesn't have the issue as it seems to run a version before Google Analytics was added.
Changing
ga.js
to have a less conspicuous name fixes the issue. Herega-loader.js
was used. In addition,ga-loader.js
was changed to fail cleanly with an error message whengoogletagmanager.com
cannot be reached (that domain is also on EasyPrivacy's block list).