]> git.parisson.com Git - django-google-tools.git/commitdiff
Updated the analytics template to current implementation
authorJ. Janssen <j.janssen@lukkien.com>
Mon, 30 Aug 2010 15:03:54 +0000 (17:03 +0200)
committerJ. Janssen <j.janssen@lukkien.com>
Mon, 30 Aug 2010 15:03:54 +0000 (17:03 +0200)
googletools/templates/googletools/analytics_code.html

index 5fb5df14bbd49f3cee89f85f9f0b0d4498b479e2..ea773d388f30a6a64a4ce0c290688b1e19e284d3 100644 (file)
@@ -1,9 +1,13 @@
 <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">
-var pageTracker = _gat._getTracker("{{ analytics_code }}");
-pageTracker._initData();
-pageTracker._trackPageview();
+
+  var _gaq = _gaq || [];
+  _gaq.push(['_setAccount', '{{ analytics_code }}']);
+  _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>
\ No newline at end of file