[m-rev.] www diff: Update Google analytics tracking code

Paul Bone paul at bone.id.au
Tue Nov 25 18:09:11 AEDT 2014


Update Google analytics tracking code

Google have updated their analytics API.  This update conforms to that
change.

include/template.inc:
    As above.
---
 include/template.inc | 31 +++++++++++--------------------
 1 file changed, 11 insertions(+), 20 deletions(-)

diff --git a/include/template.inc b/include/template.inc
index 6e2c8df..eb9998d 100644
--- a/include/template.inc
+++ b/include/template.inc
@@ -4,6 +4,17 @@
 <TITLE>The Mercury Project: <?php echo $title?></TITLE>
 <link rel="stylesheet" type="text/css" href="<?php echo $root?>/css/common.css"/>
 <link rel="icon" type="image/ico" href="../favicon.ico"/>
+
+<!-- Google Analytics -->
+<script async src='//www.google-analytics.com/analytics.js'></script>
+<script>
+window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new
+Date;
+ga('create', 'UA-39671467-1', 'auto');
+ga('send', 'pageview');
+</script>
+<!-- End Google Analytics -->
+
 </head>
 <body>
 
@@ -53,24 +64,4 @@
 
 </div>
 
-
-<?php
-/*
- * This allows us to track the popularity of our website via Google
- * Analytics.
- */
-?>
-<script type="text/javascript">
-
-  var _gaq = _gaq || [];
-  _gaq.push(['_setAccount', 'UA-39671467-1']);
-  _gaq.push(['_trackPageview']);
-
-  (function() {
-    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
-    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
-    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
-  })();
-</script>
-
 </body>
-- 
2.1.1




More information about the reviews mailing list