Google Analytics: Difference between revisions

From Open Access Directory
Jump to navigation Jump to search
(Created page with "{html}<a href="http://www.atlassian.com">Click here</a> to see the <b>Atlassian</b> website.{html}")
 
No edit summary
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
{html}<a href="http://www.atlassian.com">Click here</a> to see the <b>Atlassian</b> website.{html}
$wgHooks['BeforePageDisplay'][] = function( OutputPage &$out, Skin &$skin ) {
    $code = <<<HTML
<!-- Global site tag (gtag.js) - Google Analytics -->
<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;
};

Latest revision as of 16:35, 28 October 2019

$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;

};