Permalink
Browse files

New Google Analytics tracker code. With thanks to Richard Fergie.

  • Loading branch information...
mworrell committed Feb 1, 2011
1 parent 381c104 commit a5e85654ffd215834ce29b279d25af5b22f9fa50
Showing with 15 additions and 15 deletions.
  1. +1 −0 CONTRIBUTORS
  2. +0 −13 modules/mod_seo_google/templates/_html_body.tpl
  3. +14 −2 modules/mod_seo_google/templates/_html_head.tpl
View
@@ -23,5 +23,6 @@ Marc Worrell <marc@worrell.nl>
Marco Wessel <marco@cyberhq.nl>
Michael Connors <michael@bring42.net>
Mikael Magnusson <mikma264@gmail.com>
+Richard Fergie <richard.fergie@gmail.com>
Steve Strong <srstrong@gmail.com>
Tim Benniks <tim@timbenniks.nl>
@@ -1,13 +0,0 @@
-{% with m.config.seo_google.analytics.value as ga %}
-{% if ga %}
- <script type="text/javascript">
-var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
-document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
- </script>
- <script type="text/javascript">
- try {
- var pageTracker = _gat._getTracker("{{ ga }}");
- pageTracker._trackPageview();
- } catch(err) { }</script>
-{% endif %}
-{% endwith %}
@@ -1,4 +1,16 @@
{% with m.config.seo_google.webmaster_verify.value as wmv %}{% if wmv %}
- <meta name="verify-v1" content="{{ wmv }}" />
- <meta name="google-site-verification" content="{{ wmv }}" />
+ <meta name="google-site-verification" content="{{ wmv }}" />
+{% endif %}{% endwith %}
+{% with m.config.seo_google.analytics.value as ga %}{% if ga %}
+<script type="text/javascript">
+ var _gaq = _gaq || [];
+ _gaq.push(['_setAccount', "{{ ga }}"]);
+ _gaq.push(['_trackPageview']);
+ {% if m.acl.user %}_gaq.push(['_setCustomVar',1,'User','True',1]);{% endif %}
+ (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>
{% endif %}{% endwith %}

0 comments on commit a5e8565

Please sign in to comment.