Welcome to the Pixel Dreams Blog!

Tip

Faster, Accurate, Sans Erreurs! Google Analytics goes asynchronous!

By Mobs at 2:08 am on Tuesday, December 1, 2009 // 0 Comments

For everyone who wants to fine tune their Google Analytics, the heavy “ga.js” tracking code is a thing of the past, thanks to the new asynchronous tracking code. It really optimizes the visitor tracking by loading the tracking code faster resulting a much better user experience.

Unlike the standard tracking code, the new code inserts into the page header (<head></head>) rather than being the last element in the body tag, making code execution so much easier. It also saves a lot of pain as tracking becomes literally impossible when pages are stuffed with heavy scripts. Now with the new tracking code it’s a guarantee that your tracking will be accurate, yet a possible error with any other code snippet in the page can still occur. Be sure to use the new script above any other scripts in the header section of the page

Remember, the new tracking code is in still Beta and is available to all registered analytics users. The existing analytics code will continue and the new one is purely optional. However, given the bountiful promises, what have you got to lose? What are you waiting for? Go get it now!

P.S:
You cannot use both existing and new tracking together as it might lead to inaccurate data.
For those who want to try the new tracking code, simply replace UA-XXXXX-X with your web property ID. Your Web Property ID is the alpha numeric code with your profile name.

<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>



Tags:




Post a Comment



Search

Recent

TAG CLOUD

Categories

Archives