Difference between revisions of "MediaWiki:Common.js"

From SmartWiki
Jump to: navigation, search
 
Line 2: Line 2:
  
  
  var _gaq = _gaq || [];
+
var gaScript = document.createElement('script');
  _gaq.push(['_setAccount', 'UA-17420016-2']);
+
gaScript.setAttribute('async', '');
  _gaq.push(['_setDomainName', 'none']);
+
gaScript.setAttribute('src', 'https://www.googletagmanager.com/gtag/js?id=G-NLH5JWWVN7');
  _gaq.push(['_setAllowLinker', true]);
+
document.head.appendChild(gaScript);
  _gaq.push(['_trackPageview']);
 
  
  (function() {
+
window.dataLayer = window.dataLayer || [];
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+
function gtag(){dataLayer.push(arguments);}
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+
gtag('js', new Date());
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+
gtag('config', 'G-NLH5JWWVN7');
  })();
 

Latest revision as of 09:04, 29 July 2025

/* Any JavaScript here will be loaded for all users on every page load. */


var gaScript = document.createElement('script');
gaScript.setAttribute('async', '');
gaScript.setAttribute('src', 'https://www.googletagmanager.com/gtag/js?id=G-NLH5JWWVN7');
document.head.appendChild(gaScript);

window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-NLH5JWWVN7');