August 7th, 2007 - by Golgotha

Where did you place your Google Analytics script?

Hopefully not in the <head>…

Google’s Analytic script is pretty intensive and if placed in the head then your pages could be taking longer to load than need be.

Your script, like the one below, should be placed directly before the close of the </body> tag!

  1. <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
  2. </script>
  3. <script type="text/javascript">
  4.   _uacct = "UA-XXXXXXX-1";
  5.   urchinTracker();
  6.  
  7. </script>

Judging by the fact that some big dogs like: Copyblogger, ShoeMoney and CSSBeauty all have it wrong, you might want to check yourself.

Just trying to give you a <head>s up 🙂

13 Responses to “Don’t Use Your <head>”

1 Alex Giron

Thanks for the heads up!

CSS Beauty has been using G analytics since it came out. Back then google used to tell people to add the script to head. I guess no longer true 🙂

2 Alex Giron

Fixed!

3 Golgotha

Hey Alex, thanks for stopping by. We at Search-This love CSS Beauty; it’s a great resource for sure. And thanks for giving us a mention last week, much appreciated.

4 Jeremy

Ahh, my older version of the google-analyticator plugin for wordpress sticks it in the head. Looks like version 1.54 allows you to specify where to put the code. Thanks for this reminder!

5 Jeremy

Wow, after moving it to the footer I saw a noticeable increase in speed. Thanks again for the tip!

6 Golgotha

@Jeremy: yep, Google Analytics is a real hog, check it out in Firebug and you can see just what a pig it is. This one move can really increase load times!

7 Jelena

Yep, it was just above , but I must admit I had to check it out to be sure. 🙂

8 Jack

The reason a lot of sites have it at the top is because, when GA was first released, that’s where the instructions said to put it.

9 Chris Ovenden

So GA slows down sites? Just another reason to run NoScript…

10 Thomas

Actually, any javascript should be moved from the head space, I remember 10 years ago when I put all my javascript code in this space 😉

11 Technology Blogged

GA told people to put it there when it was first released. I actually placed it there to start with on my blog, and it slowed it down a lot.

I took it out and deleted the Cache and it works fine now. Fast as can be, although it seems to leave behind a small ‘lag’ even after I took it out.

Regards,

Jakk – your fellow Technoholic 😀

12 mack

As a Google SEOer,I have to say the google put the web load time as a important factor in google rank. so the dynamic content must be little, if you need the JS, please put it at the bottom after the dom

Thank you very much,after moving it before the close of the tag, I saw a noticeable increase in speed.

mulberry sale spyder womens jacket cheap new balance 574 mulberry outlet cheap new balance 574 arcteryx outlet mulberry sale spyder womens jacket mulberry sale spyder womens jacket mulberry outlet mulberry outlet new balance 574

Popular Articles

Top 10 Commentators


Subscribe to this feed! Subscribe by Email!

Random Bits Podcast

You need to download the Flash player from Adobe

Blogs Worth Reading