Google Analytics Asynchronous Tracking Code For Faster Page Load
Google Analytics is the best and most complete free analytics for webmasters and sometimes the Google Analytics tracking code could be the culprit for slower page loads, pages stop responding and slow down the overall load time of the website.To overcome this problem Google has come out with a new tracking alternative called Asynchronous Tracking.
What To Change ?
Remove your existing Google Analytics Code from your Website and Replace it the following code, and also replacing UA-XXXXX-X with your User Account Number (UA).
<script type=”text/javascript”>
var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-XXXXX-X']); _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); })();
</script>
Note : Place the code above the </head> tag and replace the UA-XXXXX-X with your tracking id.
What The New Code Provides ?
- Faster tracking code load times for your web pages due to improved browser execution
- Enhanced data collection & accuracy
- Elimination of tracking errors from dependencies when the JavaScript hasn’t fully loaded
Source : Google Code Blog









Thanks for the update..
Hi there,
Nice post… by the way, I just modified the Google Analytics plugin for WordPress and added the new asynchronous tracking method… Please review my post about Asynchronous Google Analytics plugin for WordPress at http://www.minilibra.com/wordpress/plugins/analytics.html
Cheers
Bambang Sugiarto