Well this is annoying…
While developing a WooCommerce plugin to reverse eCommerce transactions on Google Analytics, I started noticing an odd issue: Google Analytics was recording multiple page views for no apparent reason.
I realized the issue was occurring while viewing my Analytics’ Real-Time report. I would occasionally see a second page hit followed closely behind the first, legitimate hit. I was working in a test environment with a test Analytics profile, so the page wasn’t subject to unknown visitors; furthermore, I could see the location of the visitor and it was undoubtedly me. Like a good little developer, I assumed the problem was in my code. Well… turns out the very tool I was using to find the problem, WAS THE PROBLEM.
Here are the details.
I’m on a Mac using FireFox with Firebug and who cares what versions. With Firebug’s console opened to Net, visit your website that has the fully functional Google Analytics code installed.
Toggle over to a different browser tab showing your real-time Google Analytics report and you’ll see something like this:
Note: If you’re logged into your WordPress admin, you might not see the page hit in Google Analytics, so don’t let that fool you.
Now, toggle back to your first browser tab and scroll through the records listed in Firebug’s Net console. Eventually, you’ll come to something like _utm.gif
That little nugget is one of Google’s methods for tracking page visits and a bunch of other stuff. But here’s the gotcha…
Hover your mouse over that record. Within about a second, Firebug will attempt to show you a small preview of that image. But because the image is a 1×1 gif, you won’t see much of anything. However, if you quickly toggle back over to your real-time analytics report, you’ll see something like this:
No mouse click; no page reload; no expanding the Firebug record; nothing! Just a simple mouse hover results in a second tracked page view. Why? I don’t care why. I can only assume Firebug is retrieving a new copy of the gif (which Chrome doesn’t seem to do, by the way), resulting in a second page view, according to Google.
Is this a big deal? Maybe. Maybe not. It’s looking more an more like additional actions such as _trackEvent and _trackTrans could be affected. I’m still debugging this, but if true, you could really inadvertently mess up your eCommerce numbers (or someone else’s!).
Talk about wanting a fews hours of my life back!
Good luck!
Leave a Reply
2 Comments on "Firebug Can Cause Multiple Google Analytics Hits"
Hi Joey,
This is a helpful article for me, I really appreciate you efforts 🙂
Cool. Thanks Hemant.