Google recently released the new asynchronous analytics code but there is some confusion about where this should be placed due to an apparent error in most analytics accounts.
The old code used to go just before the closing </body> tag as it could slow the page down, however the new code takes advantage of browser support meaning the code loads much faster and can ultimately be placed much further up the page.
However, if you log into you analytics account you will see the following instructions:

But if you click the learn more link you will see conflicting information that states the code must be placed in the header of the page.

So which is it? After the opening <body> tag or before the closing </head> tag?
Luckily we are not the first people to spot this and a discussion on Analytics help boards has provided the answer. Simply put you should opt for placing the tag in the head section of the page ideally before the closing </head> tag.
This could however mean quite a few CMS updates will be required to ensure code is now placed in the correct place. For those people who can only add analytics code via their CMS the real question is will this new asynchronous code still track correctly if it isn’t in the header?
If this code is placed in the body of the page it will still work, however Google is keen to ensure it catches as many visits as possible. By placing the code higher up the page in the header it is more likely it will capture every visit (and bounce) as it will load before anything else.
Google should have already updated the Analytics advice and this thread suggests we are simply waiting for the update to filter through to all analytics accounts.
However I always think its better to be safe than sorry so make sure you place the new asynchronous code before he final </head> tag rather than in the <body> of your html. Also make sure you test the site after the new code has been installed. Make sure it works well in all browsers as there are some reports of issues in IE6 and make sure you check the data in analytics after 24 hours to see what was reported in case there is any data missing.

Glad I read your blog, I’m still using the old code for my site, it is still working though but I’d love to check out the new code. thanks…
Hi Laura,
Thanks for your comment. Although this new code will speed up page load times I would always try and keep up to date with the latest analytics code as often there are new features you can take advantage of that won’t be possible by using the old code.
You should see the new code if you log into your analytics account, click edit on the far right and then click check status in the top right.
You should then be presented with the new code.
I would recommend updating the code, however it is not essential and your old code is likely to work for many months maybe even years to come.
I hope this has helped.
Regards
Christos
Hi,
From what I have read about this, the main reason for adding this code is to speed up the loading time of each page. Our pages load in a good time already, so is this a must for Google analytics? I have logged into my account and the code is not being offered to us. Can someone please explain this in a bit more detail to more of a laymen? Many thanks!
Hi Brian,
Many thanks for your comment, the background on the issues and the clarification.
I will ensure I place the code in the head from now on.
Thanks
Christos
There’s a bit of history on this. The initial beta version of the asynchronous snippet had an issue in IE 6 and 7 when it was placed in the head of certain pages that contained BASE tags. The initial workaround for that problem was to put the snippet at the top of the BODY section instead of the HEAD. In March, we updated the snippet code to fix the issues. If you’re using the code published since march (link below), it’s completely safe to put the code in the HEAD in any browser on any page. We still have some lingering documentation saying it should go in the BODY. Ignore that, and if you’re still unsure, please contact me.
http://code.google.com/apis/analytics/docs/tracking/asyncTracking.html
Thanks,
Brian