mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-07 03:12:33 +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
@ -79,7 +79,11 @@ const redirectableResources = new Map([
|
||||
data: 'text', // Important!
|
||||
} ],
|
||||
[ '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',
|
||||
} ],
|
||||
[ 'google-analytics_cx_api.js', {
|
||||
@ -96,10 +100,6 @@ const redirectableResources = new Map([
|
||||
alias: 'googlesyndication.com/adsbygoogle.js',
|
||||
data: 'text',
|
||||
} ],
|
||||
[ 'googletagmanager_gtm.js', {
|
||||
alias: 'googletagmanager.com/gtm.js',
|
||||
data: 'text',
|
||||
} ],
|
||||
[ 'googletagservices_gpt.js', {
|
||||
alias: 'googletagservices.com/gpt.js',
|
||||
data: 'text',
|
||||
|
@ -74,9 +74,18 @@
|
||||
w[gaName] = ga;
|
||||
// https://github.com/gorhill/uBlock/issues/3075
|
||||
const dl = w.dataLayer;
|
||||
if ( dl instanceof Object && dl.hide instanceof Object && typeof dl.hide.end === 'function' ) {
|
||||
if ( dl instanceof Object ) {
|
||||
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
|
||||
if ( gaQueue instanceof Function && Array.isArray(gaQueue.q) ) {
|
||||
for ( const entry of gaQueue.q ) {
|
||||
|
Loading…
Reference in New Issue
Block a user