Google Analytics a Bit Goofy
A couple of weeks back I noticed that the figure being reported by Google Analytics representing our page views was less than our ad impressions. There is room for variance, for example the top leaderboard also appears on QBase, which isn’t in our overall traffic count, although I have access to figures for the site. Although QBase occasionally has some strong traffic, the gap wasn’t accounted for; it was clear that either our ad service was overcounting impressions, or Google Analytics was wrong.
Then it got weirder. We run Adsense units as remnant inventory, and on a couple of days Adsense was showing a higher page count than Analytics was. Something was clearly wrong. I did some digging and while there has been issues with Google Analytics in the past, nothing explained what I was seeing.
Then I worked it out. We may not have the quickest page load at The Inquisitr, but I’ve always been wary of not making the site bloated to load, like Mashable (which was up at one stage to 2mb on the front page) and TechCrunch (which has slimmed back, but was traditionally a heavy load). There are external factors I can’t control, the ad serving for one, and then services like Lijit and Outbrain do slow the site down, sometimes more than others. But still, the load isn’t horrible. And yet when I started the site, I was focused on delivering the content first, with the rest to follow. The header naturally leads with the content following, but the rest of the sidebar then eventually footer loads after that. Some times the load time can be seconds, other times (and depending on your connection and whether you’ve visited the site before) it can be out to 30 seconds or more. I realized that the difference, even between the post footer ad and the sidebar ad were that people were hitting the site and leaving it before the other things had loaded. And where was the Google Analytics code you ask? Last thing loaded in the footer.
Google recommends that you put the code for Google Analytics in the footer, and I’m not about to tell you to disagree with them, but a couple of days back I swapped the code from the footer to the header, and 2 days in all of a sudden my ads views are a close match to my Google Analytics page views.
If you’re running a WordPress blog and thinking of trying the code up front, it must reside after the body tag, but if it’s in your header and that’s the first part of a page load, it’s a 99% bet that every page view will be counted.