Difference between revisions of "MediaWiki:Common.js"

From SmartWiki
Jump to: navigation, search
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
 
/* Any JavaScript here will be loaded for all users on every page load. */
 
/* Any JavaScript here will be loaded for all users on every page load. */
  
<script type="text/javascript">
 
alert('comon script loaded');
 
  var _gaq = _gaq || [];
 
  _gaq.push(['_setAccount', 'UA-17420016-2']);
 
  _gaq.push(['_setDomainName', 'none']);
 
  _gaq.push(['_setAllowLinker', true]);
 
  _gaq.push(['_trackPageview']);
 
  
  (function() {
+
var gaScript = document.createElement('script');
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+
gaScript.setAttribute('async', '');
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+
gaScript.setAttribute('src', 'https://www.googletagmanager.com/gtag/js?id=G-NLH5JWWVN7');
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+
document.head.appendChild(gaScript);
  })();
 
  
</script>
+
window.dataLayer = window.dataLayer || [];
 +
function gtag(){dataLayer.push(arguments);}
 +
gtag('js', new Date());
 +
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');