• Skip to primary navigation
  • Skip to main content
  • Skip to footer

WPJohnny

WordPress Performance Guides and Reviews

  • Start a WordPress site
  • Hosting
  • Themes
  • Plugins
  • Blogging
  • Marketing

Should you load Google Analytics in HEADER or FOOTER?

WordPress hosting Mar 9, 2019 by Johnny 6 Comments

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

Why?

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

Share this post:

Share on FacebookShare on X (Twitter)Share on LinkedInShare on WhatsAppShare on EmailShare on SMS

Read all my posts on WordPress hosting

About Johnny

Right on the edge of WordPress development! 10+ years of WordPress design, development, hosting, speed optimization, product advisor, marketing, monetization. I do all that.

More WordPress Guides

WP Admin Dashboard – UI design fantasies

Removing WordPress user registration spam

Swift Performance Lite – WordPress Cache Speed Plugin REVIEW

Why use cPanel in 2021

How to get FREE STUFF on Amazon

WHY to always use a Transactional Email Service

Reader Interactions

6 Comments

  1. Leif

    March 10, 2019 at 10:24 am

    You could go with something like this if you need to minimize https://minimalanalytics.com .. in the footer of course .. 😉

    Reply
    • Johnny

      March 10, 2019 at 2:05 pm

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

      Reply
    • Mato

      October 1, 2020 at 1:59 pm

      It would be really cool to know how to add some parameters to the coders for non-beginners like me. In particular, anonymize IP, disable add features and add adjusted bounce rate to the code.

      Reply
  2. Leif

    March 10, 2019 at 4:53 pm

    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 .. =)

    Reply
    • Johnny

      March 10, 2019 at 5:18 pm

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

      Reply
      • Leif

        March 10, 2019 at 6:51 pm

        Haha .. You do that, why do the hard work yourself .. 😉

        Reply

Leave a Reply Cancel reply

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

Footer

More links

  • Gadget reviews
  • Try my free WPJ plugins
  • Join the WPJ FB Group
  • WPJ YouTube & newsletter
  • Become a WPJ Affiliate

Popular Reviews

  • Best WordPress Hosting
  • Best WordPress Themes
  • Best WordPress Plugins
  • Best WordPress Cache Plugins

Services

  • Speed optimization
  • Speed optimization courses
  • WordPress hosting
  • Hire me or other experts
  • Client login

About Johnny

10+ years of WordPress design, development, hosting, speed optimization, marketing.
Contact me.

newsletter block

Copyright 2025 | WordPress guides by Johnny Nguyen

Click to Copy