mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-10 09:07:54 +01:00
Make googletagmanager_gtm.js an alias of google-analytics_analytics.js
Related feedback: - https://ilakovac.com/teespring-ublock-issue/ The surrogate script googletagmanager_gtm.js was essentially a subset of surrogate script google-analytics_analytics.js. This commit makes it a plain alias so that the whole GA API -- often expected by clients of GTM -- is properly stubbed.
This commit is contained in:
parent
4509df154f
commit
8cd2a1d263
2 changed files with 16 additions and 7 deletions
|
@ -79,7 +79,11 @@ const redirectableResources = new Map([
|
||||||
data: 'text', // Important!
|
data: 'text', // Important!
|
||||||
} ],
|
} ],
|
||||||
[ 'google-analytics_analytics.js', {
|
[ 'google-analytics_analytics.js', {
|
||||||
alias: 'google-analytics.com/analytics.js',
|
alias: [
|
||||||
|
'google-analytics.com/analytics.js',
|
||||||
|
'googletagmanager_gtm.js',
|
||||||
|
'googletagmanager.com/gtm.js'
|
||||||
|
],
|
||||||
data: 'text',
|
data: 'text',
|
||||||
} ],
|
} ],
|
||||||
[ 'google-analytics_cx_api.js', {
|
[ 'google-analytics_cx_api.js', {
|
||||||
|
@ -96,10 +100,6 @@ const redirectableResources = new Map([
|
||||||
alias: 'googlesyndication.com/adsbygoogle.js',
|
alias: 'googlesyndication.com/adsbygoogle.js',
|
||||||
data: 'text',
|
data: 'text',
|
||||||
} ],
|
} ],
|
||||||
[ 'googletagmanager_gtm.js', {
|
|
||||||
alias: 'googletagmanager.com/gtm.js',
|
|
||||||
data: 'text',
|
|
||||||
} ],
|
|
||||||
[ 'googletagservices_gpt.js', {
|
[ 'googletagservices_gpt.js', {
|
||||||
alias: 'googletagservices.com/gpt.js',
|
alias: 'googletagservices.com/gpt.js',
|
||||||
data: 'text',
|
data: 'text',
|
||||||
|
|
|
@ -74,8 +74,17 @@
|
||||||
w[gaName] = ga;
|
w[gaName] = ga;
|
||||||
// https://github.com/gorhill/uBlock/issues/3075
|
// https://github.com/gorhill/uBlock/issues/3075
|
||||||
const dl = w.dataLayer;
|
const dl = w.dataLayer;
|
||||||
if ( dl instanceof Object && dl.hide instanceof Object && typeof dl.hide.end === 'function' ) {
|
if ( dl instanceof Object ) {
|
||||||
dl.hide.end();
|
if ( dl.hide instanceof Object && typeof dl.hide.end === 'function' ) {
|
||||||
|
dl.hide.end();
|
||||||
|
}
|
||||||
|
if ( typeof dl.push === 'function' ) {
|
||||||
|
dl.push = function(o) {
|
||||||
|
if ( o instanceof Object && typeof o.eventCallback === 'function' ) {
|
||||||
|
setTimeout(o.eventCallback, 1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// empty ga queue
|
// empty ga queue
|
||||||
if ( gaQueue instanceof Function && Array.isArray(gaQueue.q) ) {
|
if ( gaQueue instanceof Function && Array.isArray(gaQueue.q) ) {
|
||||||
|
|
Loading…
Reference in a new issue