1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-15 07:22:28 +02:00

Improve GA's surrogate script

Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1807
This commit is contained in:
Raymond Hill 2021-11-09 13:20:49 -05:00
parent 4efa6be96b
commit 6f49e079db
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -38,12 +38,14 @@
if ( typeof a === 'function' ) {
a(); return;
}
if ( Array.isArray(a) === false ) {
return;
}
// https://twitter.com/catovitch/status/776442930345218048
if ( Array.isArray(a) === false ) { return; }
// https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiDomainDirectory#_gat.GA_Tracker_._link
if ( a[0] === '_link' && typeof a[1] === 'string' ) {
// https://github.com/uBlockOrigin/uBlock-issues/issues/1807
if (
typeof a[0] === 'string' &&
/(^|\.)_link$/.test(a[0]) &&
typeof a[1] === 'string'
) {
window.location.assign(a[1]);
}
// https://github.com/gorhill/uBlock/issues/2162