Having trouble getting Google Analytics to acknowledge a sites tracking 
code.

I can see it in the generated pages and looks okay.

Have noticed that the code in Mezzanine was last updated in 2012 and 
wondered if it needs updating as it appears quite different from the 
suggested code from Google.

Google's suggestion:

<script>
  
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new 
Date();a=s.createElement(o),
  
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-XXXXXX-1', 'auto');
  ga('send', 'pageview');

</script>


Mezzanine's code:

<script>
{% if settings.GOOGLE_ANALYTICS_ID and not request.user.is_staff %}
var _gaq = _gaq || [['_trackPageview']];
_gaq.unshift(['_setAccount', '{{ settings.GOOGLE_ANALYTICS_ID }}']);
(function(d, t) {
    var g = d.createElement(t),
        s = d.getElementsByTagName(t)[0];
    g.async = true;
    g.src = '//www.google-analytics.com/ga.js';
    s.parentNode.insertBefore(g, s);
})(document, 'script');
{% endif %}
</script>


Anyone experiencing any issues with the code ?


regards

mark

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to