We’ve decided to jump into the large amount of authors offering Google Analytics plugins with our own version. To put it simply, the vast majority of Google Analytics plugins for WordPress are slowing down websites — something that we’ve noticed time and again over several years of SEO consulting.
While Google released an “async” version of their popular tracking code back in 2009, leading dozens of bloggers to declare “load it in your header, it won’t slow down your site anymore!” the truth is that this is, as usual, a theoretical, rather than practical, conclusion. In reality, anytime a browser or device is loading third party resources so early in the DOM, whether “async” or not, it’s still causing the browser/device to focus on that resource. And since GA evangelists love theory so much, we propose considering the typical low-end smartphone with limited RAM (etc) loading your website over 2G or 3G (still very common in the world) and having to “async” load third party resources at the same time as your page layout and design basics. Saving this debate for another blog post, the key differences between “deferred” and “async” seem to have been lost somewhere on the web in the years since 2009.
As time goes on, GA continues to get more complex, in any case, as more high tech marketers add variables and event tracking pieces all over their source code. This means that going forward it’s going to start making more and more sense to load those variables and trackers first, and the actual GA snippet last (or as late as possible).
The only (seriously, ONLY) time loading GA in the footer could be “bad” is if you have a visitor clicking on links (etc) within perhaps the first 100 milliseconds of the page loading, or some similar time frame (extremely fast). But again this is “theory” because if your page hasn’t finished loading at least the majority of DOM then its highly doubtful that users are browsing around your site until they can actually see your layout.
This is opening up a can of “case study” worms perhaps, and if we have time we will get to that eventually on our blog.
Currently this plugin is very bare bones, and simply loads GA just before the
tag, with a very basic settings page available in WordPress. In the future, we may consider adding one of those fancy API-based traffic graphs in the WP Admin Dashboard although frankly, it’s not a priority. Cheers!