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

uBlock GA overwrites breaking _link implementation when using a named property #1807

Closed
8 tasks done
felipedeboni opened this issue Nov 9, 2021 · 4 comments
Closed
8 tasks done
Labels
fixed issue has been addressed

Comments

@felipedeboni
Copy link

Prerequisites

I tried to reproduce the issue when...

  • uBO is the only extension
  • uBO with default lists/settings
  • using a new, unmodified browser profile

Description

uBlock seems to overwrite GA script, which is fine. The issue is "_link" push wouldn't work if using a named property.

Example without a named property:
js _gaq.push(['_link', url]);

Example using a named property:
js _gaq.push(['named._link', url]);

Relevant code from uBlock GA:

Gaq.prototype.push = function(a) {
        if ( typeof a === 'function' ) {
            a(); return;
        }
        if ( Array.isArray(a) === false ) {
            return;
        }
        // https://twitter.com/catovitch/status/776442930345218048
        // https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiDomainDirectory#_gat.GA_Tracker_._link
        if ( a[0] === '_link' && typeof a[1] === 'string' ) {
            window.location.assign(a[1]);
        }
        // https://github.com/gorhill/uBlock/issues/2162
        if ( a[0] === '_set' && a[1] === 'hitCallback' && typeof a[2] === 'function' ) {
            a[2]();
        }
    };

If using a named property, a[0] is going to be {name here}._link and nothing would have been done.

A specific URL where the issue occurs

https://wms2demo-201.previews.funeralone.com/store/best-sellers/beautiful-in-blue

Steps to Reproduce

  1. Open the URL
  2. Type anything on the "Name of Deceased"
  3. Click on "Buy Now"
  4. It's going to redirect after 60 seconds because the uBlock broke "_link" implementation and we have a setTimeout to ensure the redirect

Expected behavior

Works the same way when the GA property isn't named, makes a redirect.

Actual behavior

It does not redirect.

uBlock Origin version

uBlock Origin 1.38.6

Browser name and version

Chrome 95.0.4638.69

Operating System and version

macOS 10.14.6

gorhill added a commit to gorhill/uBlock that referenced this issue Nov 9, 2021
@gwarser gwarser added the fixed issue has been addressed label Nov 9, 2021
@gwarser gwarser closed this as completed Nov 9, 2021
@gorhill
Copy link
Member

gorhill commented Nov 9, 2021

@wisniewskit, for your interest, you may want to update Firefox's shim the same way.

@wisniewskit
Copy link

Thanks for the ping, @gorhill ! Might we also want to do the same kind of test for the _set case as well?

@gorhill
Copy link
Member

gorhill commented Nov 9, 2021

Might we also want to do the same kind of test for the _set case as well?

Personally on my side I prefer to have actual concrete reproducible cases to justify such change, I don't feel comfortable to change this without knowing whether this really happens out there.

gorhill added a commit to gorhill/uBlock that referenced this issue Nov 9, 2021
@wisniewskit
Copy link

Understood, thanks. I'm inclined to agree.

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

No branches or pull requests

4 participants