Google Analytics
$wgHooks['BeforePageDisplay'][] = function( OutputPage &$out, Skin &$skin ) {
$code = <<<HTML
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-151018458-1"></script> <script>
window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date());
gtag('config', 'UA-151018458-1');
</script> HTML;
$out->addHeadItem( 'gtag-insert', $code ); return true;
};