uBlock Origin leitet Google Analytics um statt zu blocken.

doubleh

doubleh

Aktives Mitglied
Thread Starter
Dabei seit
13.06.2009
Beiträge
2.639
Reaktionspunkte
211
Hallo,

mir ist eben im Edge Browser, in der Console aufgefallen, dass anfragen an Google Analytics nicht blockiert werden, so wie alle anderen Tracking/Werbung/was auch immer Dinge, sondern es wird weitergeleitet an ein Script von uBlock. Die Script-Datei befindet sich im Ordner "web_accessible_resources" die Datei nennt sich "59fb24a2d12455d15bea20980e8a6801" und der Code befindet sich unten im Post.
Ich habe leider gar keine Ahnung vom Programmieren und wollte mal fragen, ob hier jemand weiß, was dort passiert.
(In der uBlock App unter Google Chrome passiert genau das gleiche und es ist auch die gleiche App, allerdings steht beim Chrome nicht viel in der Console. Die Console vom Edge ist da detaillierter, deswegen habe ich den Browser oben genannt)

Danke
doubleh

edit: Hier noch der Text in der Console: "BHX19002: Die Anforderung an https://www.google-analytics.com/analytics.js wird durch die Erweiterung EdgeExtension_37833NikRollsuBlockOrigin_f8jsg5mm64m62 an ms-browser-extension://EdgeExtension_37833NikRollsuBlockOrigin_f8jsg5mm64m62/web_accessible_resources/59fb24a2d12455d15bea20980e8a6801.js?secret=rynf9gnb0q31 umgeleitet."
was hat es mit dem "secret" aufsich :confused:
Code:
(function() {
    // https://developers.google.com/analytics/devguides/collection/analyticsjs/
    var noopfn = function() {
        ;
    };
    var noopnullfn = function() {
        return null;
    };
    //
    var Tracker = function() {
        ;
    };
    var p = Tracker.prototype;
    p.get = noopfn;
    p.set = noopfn;
    p.send = noopfn;
    //
    var w = window,
        gaName = w.GoogleAnalyticsObject || 'ga';
    var ga = function() {
        var len = arguments.length;
        if ( len === 0 ) {
            return;
        }
        var f = arguments[len-1];
        if ( typeof f !== 'object' || f === null || typeof f.hitCallback !== 'function' ) {
            return;
        }
        try {
            f.hitCallback();
        } catch (ex) {
        }
    };
    ga.create = function() {
        return new Tracker();
    };
    ga.getByName = noopnullfn;
    ga.getAll = function() {
        return [];
    };
    ga.remove = noopfn;
    w[gaName] = ga;
    // https://github.com/gorhill/uBlock/issues/3075
    var dl = w.dataLayer;
    if ( dl instanceof Object && dl.hide instanceof Object && typeof dl.hide.end === 'function' ) {
        dl.hide.end();
    }
})();
 
Erster Treffer bei Google:
https://github.com/gorhill/uBlock/issues/1170#issuecomment-168989068
uBO blocks Google Analytics ("GA") -- but since last night, it also redirects the blocked network request for the GA script to a neutered version of the blocked GA script (which is the code you are seeing), so as to minimize web page breakages, some web pages will not work properly when you block Google Analytics.

The neutered version does nothing, its purpose is to just declare the API (only empty function calls as you can see) that some web pages expect to be there without ever testing first -- causing the pages to break.

An example, reported yesterday: http://www.biirdiegolf.com/ breaks when blocking GA (the links won't work), but still works fine when using uBO's neutered version of GA (another example). This motivated me to bring the GA filter out of experimental status.

I didn't know Ghostery did the same, I don't use Ghostery. The issue here is not really one, it's more a warning from the browser API: only one extension is allowed to redirect a network request. I can't remember off the top of my head, but I think the "winner" is the last extension installed. So if ever you reverse the order of installation between uBO and Ghostery, a warning will be reported for Ghostery instead. Aside the warning itself, there is no functional issue.

In summary, the network requests to Google Analytics are blocked, but only one of the extension will be able to redirect to its neutered script as replacement (I am assuming Ghostery's replacement script is also a neutered version, I did not look into it). Result of using a neutered script as replacement: less page breakage while still blocking GA.

The resources used by uBO for redirection purpose are found in this file. Support for redirection was introduced in version 1.4.0.
 
  • Gefällt mir
Reaktionen: doubleh
Zurück
Oben Unten