Should you load Google Analytics in HEADER or FOOTER?

Easy question for me! Load Google Analytics in the footer!


  • Because I want the best performance possible. I don’t want GA script to slow down initial rendering for things that actually appear on the screen!
  • Because your site shouldn’t be loading that slow anyway between header vs footer items. If your site IS that slow, you need to fix it first before slowing it down even further.
  • Because GA stats are nice but I don’t look at them THAT much. The most important thing is user experience.

Is there ever an argument for when to put GA scripts in the header?

Sure, there are some. The main one being that having the Analytics script load sooner will ensure that your users are tracked more accurately. The idea is that you don’t want to miss out on what user actions are happening before the script is loaded. There’s also the argument that loading the GA script later may increase your bounce rates because it’ll seem like your users are leaving your site faster.

For the most part, I think all the excuses are bunk. It should only be a 100-200ms difference between loading the GA script in the header vs the footer. If your visitor can decide to leave your site within that time, then was that really even a worthwhile interaction to track in the first place?

There’s also the argument that the GA script is asynchronous and doesn’t block page-render and that the script will load alongside all other JS scripts. That may be so but the still has to be read and processed and who knows what else is going on. I also like what the PagePipe guys had to say on the matter.

Don’t be silly. Load GA in the footer and get on with your life. Serve your users, not Google!

  • Which plugin to load Google Analytics? I use CAOS plugin – it saves and serves the file locally from your web-server to decrease external requests from dragging down your pageload.

5 thoughts on “Should you load Google Analytics in HEADER or FOOTER?

    1. Hey hey hey, that’s VERY COOL! Have you verified it already??? Just curious what the implications are of using this minimized script.

  1. Hi there Johnny,

    It works, I use it on my WordPress sites .. You can read on the site about advanced Analytics, seems like some functions don´t work, but I am not using advanced functions in Analytics anyway so for my purpose of standard Analytics it works just fine.

    Found your site a couple of weeks ago and there is some good stuff for newbies here .. Don´t have an FB account so I have not checked the FB group your active in though .. and probably won´t either since I am not on FB .. =)

    1. Haha, thanks so much for this. I read up on it a bit at Github but I think I’m just gonna offer it to the community for them to guinea-pig it. 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *