Skip to content
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

Redirect feature #1020

Closed
FTno opened this issue Dec 6, 2015 · 11 comments
Closed

Redirect feature #1020

FTno opened this issue Dec 6, 2015 · 11 comments

Comments

@FTno
Copy link

FTno commented Dec 6, 2015

http://www.tv2.no/v/989822/

Blocking ga.js (http://www.google-analytics.com/ga.js) breaks this page (and other video pages on the site too). The video will not play and an error message with something like 'ga.js not found' is displayed.

I tested the new redirect feature with this filter:
||www.google-analytics.com/ga.js$script,domain=tv2.no,redirect=ga.js
and then with this:
||www.google-analytics.com/ga.js$script,domain=tv2.no,redirect=www.google-analytics.com/ga.js

They did not work.

Is something wrong with the filters or is the new feature not capable of dealing with this case.

Tested with: UBlock 1.3.7b15, Chrome 46, Firefox 42

@gorhill
Copy link
Owner

gorhill commented Dec 6, 2015

Does this work:

@@||www.google-analytics.com/ga.js$script,domain=www.tv2.no

?

The redirect filter option will need more work to craft a proper dummy look-alike script for www.google-analytics.com/ga.js, so I will use this site to help further its development. But to just un-break the site, see if the above filter work (I get an error message but I am guessing its telling me the video is not available outside Norway). If the above filter work, I will add it to uBO's Unbreak filter list.

@FTno
Copy link
Author

FTno commented Dec 6, 2015

No, it does not work.

@gorhill
Copy link
Owner

gorhill commented Dec 6, 2015

@@||www.google-analytics.com^$domain=www.tv2.no ?

@FTno
Copy link
Author

FTno commented Dec 6, 2015

Sorry, I forgot that I had this in 'My Filters': ||google-analytics.com^$important.
By removing that this works: @@||www.google-analytics.com/ga.js$script,domain=www.tv2.no

But this is not what I want because if I understand correctly, this will allow google-analytics on the whole site. So I would not like to have the filter in the Unbreak filter list. As it is now I use dynamic filtering to unbreak each time I want to see a video.

@harshanvn
Copy link

I tried the link given by OP..

As soon as i allow ga.js, i no longer see "ga.js is not found" message. However i cannot have the video played because of the site's country specific restrictions...

So, tweaking ga.js surrogate should work i believe..

@gorhill
Copy link
Owner

gorhill commented Dec 6, 2015

So I would not like to have the filter in the Unbreak filter list.

That's the purpose of the Unbreak filter list. Some other people are probably suffering the break, so this needs to be resolved. On the other hand, just keep your * google-analytics.com * block rule and unbreak as you see fit using a noop rule -- bottom line being that your choice of blocking Google Analytics is not being overriden by the Unbreak filter list.

@gorhill
Copy link
Owner

gorhill commented Dec 6, 2015

So, tweaking ga.js surrogate should work i believe.

I need to work a whole lot more on this before (and if) I can make this work. What I need are cases of web page breakage caused by the blocking of ga.js, so the case here is useful to further the replacement code for ga.js.

@harshanvn
Copy link

just fyi..just thought it might help you..

Looks like noscript surrogate is able to thwart it successfully. (i.e., i see the message sth read as "the video cannot be played in your country")

(function() {
    var _0 = $S(function() _0),
        _u = function() {};
    _0.__noSuchMethod__ = _0;
    ('ga' in window) || (ga = _u);
    with(window) urchinTracker = _u, _gaq = $S({
        __noSuchMethod__: _0,
        push: function(f) {
            if (typeof f == 'function') f();
            else if (f && f.shift && f[0] in this) this[f.shift()].apply(this, f)
        },
        _set: function(a, b) {
            if (typeof b == 'function') b()
        },
        _link: function(h) {
            if (h) location.href = h
        },
        _linkByPost: function(f) {
            if (f && f.submit) f.submit();
            return true
        },
        _getLinkerUrl: function(u) {
            return u
        },
        _trackEvent: _0
    }), _gat = $S({
        __noSuchMethod__: function() {
            return _gaq
        }
    })
})()

@gorhill
Copy link
Owner

gorhill commented Dec 6, 2015

I prefer to do the reverse engineering myself, as I will be the one maintaining this, doing it myself ensure I know what is happening inside.

I already made changes which to uBO ga.js to the point where I now get the "cannot be played in your country" message. Now this will have to be tested by someone from no to see if it really works.

@harshanvn
Copy link

I prefer to do the reverse engineering myself

Yes sir, I know :). Just could not help myself!!

doing it myself ensure I know what is happening inside.

Agreed.

@FTno
Copy link
Author

FTno commented Dec 7, 2015

Redirect for ga.js now works for the videos with v.1.4.0rc0 and with this filter: ||www.google-analytics.com/ga.js$script,domain=tv2.no,redirect=www.google-analytics.com/ga.js, and also without this filter and instead using the experimental filter - while http://www.google-analytics.com/ga.js is shown in the logger as blocked in both cases. Tested with both Chrome and Firefox.
Thanks for fixing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants