Skip to content
Browse files

Merge pull request #433 from iurisilvio/patch-1

Use async Google Analytics code.
  • Loading branch information...
2 parents 3aca0d8 + 172555b commit 7b5b99b04bd49f24054d071d55bd53bb15ea00ef @almet almet committed Aug 16, 2012
Showing with 8 additions and 7 deletions.
  1. +8 −7 pelican/themes/notmyidea/templates/analytics.html
View
15 pelican/themes/notmyidea/templates/analytics.html
@@ -1,11 +1,12 @@
{% if GOOGLE_ANALYTICS %}
<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"));
+ var _gaq = _gaq || [];
+ _gaq.push(['_setAccount', '{{GOOGLE_ANALYTICS}}']);
+ _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>
- <script type="text/javascript">
- try {
- var pageTracker = _gat._getTracker("{{GOOGLE_ANALYTICS}}");
- pageTracker._trackPageview();
- } catch(err) {}</script>
{% endif %}

0 comments on commit 7b5b99b

Please sign in to comment.
Something went wrong with that request. Please try again.