MediaWiki:Mobile.js: Difference between revisions
Jump to navigation
Jump to search
(Google Analytics 4) |
m (fix) |
||
Line 9: | Line 9: | ||
) { | ) { | ||
gtag('js', new Date()); | gtag('js', new Date()); | ||
gtag('config', 'G- | gtag('config', 'G-27TV985M46'); | ||
$('head').append($('<script/>').attr('async', 1).attr('src', 'https://www.googletagmanager.com/gtag/js?id=G- | $('head').append($('<script/>').attr('async', 1).attr('src', 'https://www.googletagmanager.com/gtag/js?id=G-27TV985M46')); | ||
} | } | ||
/* /Google Analytics 4 */ | /* /Google Analytics 4 */ |
Latest revision as of 12:45, 8 November 2023
/* All JavaScript here will be loaded for users of the mobile site */ /* Google Analytics 4 */ window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} if ( // Not tracked: admin/bot users, anyone on login/logout pages. !(',' + mw.config.get('wgUserGroups').join(',') + ',').match(/,(sysop|bureaucrat|bot),/) && ['Userlogin', 'Userlogout', 'Preferences', 'Resetpass'].indexOf(mw.config.get('wgCanonicalSpecialPageName')) === -1 ) { gtag('js', new Date()); gtag('config', 'G-27TV985M46'); $('head').append($('<script/>').attr('async', 1).attr('src', 'https://www.googletagmanager.com/gtag/js?id=G-27TV985M46')); } /* /Google Analytics 4 */