Difference between revisions of "MediaWiki:Common.js"

From Recidemia
Jump to: navigation, search
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. */
alert("HELLO");
+
<!-- Global site tag (gtag.js) - Google Analytics -->
<!-- End Google Analytics -->
+
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-30695810-1"></script>
$wgExtensionFunctions[] = 'wfGoogleAnalytics';
+
<script>
function wfGoogleAnalytics() {
+
  window.dataLayer = window.dataLayer || [];
global $wgOut;
+
  function gtag(){dataLayer.push(arguments);}
$wgOut->addScript(
+
  gtag('js', new Date());
'<script type="text/javascript">
+
 
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
+
  gtag('config', 'UA-30695810-1');
document.write(unescape("%3Cscript src=\'" + gaJsHost + "google-analytics.com/ga.js\' type=\'text/javascript\'%3E%3C/script%3E"));
+
</script>
</script><script type="text/javascript">
 
var pageTracker = _gat._getTracker("UA-30695810-1");
 
pageTracker._trackPageview();</script>'
 
);
 
}
 

Revision as of 13:07, 20 April 2018

/* Any JavaScript here will be loaded for all users on every page load. */
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-30695810-1"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-30695810-1');
</script>