Skip to content

Commit

Permalink
Make googletagmanager_gtm.js an alias of google-analytics_analytics.js
Browse files Browse the repository at this point in the history
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.

Related commits:
- gorhill/uBlock@8cd2a1d

Co-authored-by: Raymond Hill <[email protected]>
  • Loading branch information
JustOff and gorhill committed Jun 11, 2021
1 parent 5559561 commit 6d1c0c0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
13 changes: 11 additions & 2 deletions assets/resources/resources.txt
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,17 @@ google-analytics.com/analytics.js application/javascript
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' ) {
dl.hide.end();
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) ) {
Expand Down
3 changes: 2 additions & 1 deletion src/js/assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,8 @@ api.fetchFilterList.legacy = {
'=google-analytics_ga.js': '=google-analytics.com/ga.js',
'=google-analytics_inpage_linkid.js': '=google-analytics.com/inpage_linkid.js',
'=googlesyndication_adsbygoogle.js': '=googlesyndication.com/adsbygoogle.js',
'=googletagmanager_gtm.js': '=googletagmanager.com/gtm.js',
'=googletagmanager_gtm.js': '=google-analytics.com/analytics.js',
'=googletagmanager.com/gtm.js': '=google-analytics.com/analytics.js',
'=googletagservices_gpt.js': '=googletagservices.com/gpt.js',
'=ligatus_angular-tag.js': '=ligatus.com/*/angular-tag.js',
'=monkeybroker.js': '=d3pkae9owd2lcf.cloudfront.net/mb105.js',
Expand Down
2 changes: 1 addition & 1 deletion src/js/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ var onVersionReady = function(lastVersion) {
µb.assets.purge('ublock-resources');

// Force updating all filters due to filter syntax converter update.
if ( vAPI.app.compareVersions(lastVersion, "1.16.4.27") <= 0 ) {
if ( vAPI.app.compareVersions(lastVersion, "1.16.4.28") <= 0 ) {
µb.assets.purge(/./, 'public_suffix_list.dat');
}

Expand Down

0 comments on commit 6d1c0c0

Please sign in to comment.