MediaWiki:Common.js: Difference between revisions
Main Page: language button at the top, like other pages |
Add Google Analytics 4 (anonymous visitors only) |
||
| Line 131: | Line 131: | ||
} | } | ||
} ); | } ); | ||
/* Google Analytics 4 (property "Chabadpedia English - GA4"), not loaded for logged-in users */ | |||
( function () { | |||
if ( mw.config.get( 'wgUserName' ) !== null ) { | |||
return; | |||
} | |||
var id = 'G-V6K7LP5ZTY'; | |||
var s = document.createElement( 'script' ); | |||
s.async = true; | |||
s.src = 'https://www.googletagmanager.com/gtag/js?id=' + id; | |||
document.head.appendChild( s ); | |||
window.dataLayer = window.dataLayer || []; | |||
window.gtag = function () { window.dataLayer.push( arguments ); }; | |||
window.gtag( 'js', new Date() ); | |||
window.gtag( 'config', id ); | |||
}() ); | |||