From 46307eb836664409e15b4eab669f6b6f9f80afd8 Mon Sep 17 00:00:00 2001 From: Chris Adams Date: Wed, 2 Dec 2009 21:56:24 +0800 Subject: [PATCH] Switch to Asynchronous Tracking This avoids a common GA performance hit: http://googlecode.blogspot.com/2009/12/google-analytics-launches-asynchronous.html --- .../google_analytics/analytics_template.html | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/google_analytics/templates/google_analytics/analytics_template.html b/google_analytics/templates/google_analytics/analytics_template.html index 4335675..4bf6b69 100644 --- a/google_analytics/templates/google_analytics/analytics_template.html +++ b/google_analytics/templates/google_analytics/analytics_template.html @@ -1,10 +1,12 @@ - +var _gaq = _gaq || []; +_gaq.push(['_setAccount', '{{ analytics_code }}']); +_gaq.push(['_trackPageview']); +(function() { +var ga = document.createElement('script'); +ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; +ga.setAttribute('async', 'true'); +document.documentElement.firstChild.appendChild(ga); +})(); + \ No newline at end of file -- 2.39.5