Long Page URLs in Internet Explorer Cause Missing Pageviews, Transactions in Google Analytics
While LunaMetrics.com is known best for our blog content, the vast majority of our time goes towards helping clients with Google Analytics implementation. Our clients often come to us with some form of existing Google Analytics, and it’s our job to sift through the data to make sure everything is being collected correctly. For a website with eCommerce, this involves comparing data from GA to a back-end sales system to make sure everything matches. We’ve found many strange and buggy scenarios, but one in particular stands out as a particularly difficult challenge.
In the scenario below, a client’s website appended an internal key as a query parameter to transaction pages to help with their processing. These keys were huge and the page URLs would sometimes hit 1400 or 1500 characters. When a hit gets sent to Google Analytics, all of the details about the page and the visitor are combined together into one long image request which gets sent to their server. However, Internet Explorer, and more specifically, Internet Explorer 9, imposes a cap on the length of these requests. Because the page URLs were so long, some hits to Google were just failing at the browser level and never made their way to GA.
Continue reading for a “chart review” of how we diagnosed the issue, and then further on for steps on how to fix this for yourself!
Chart Review: The Missing Data in IE
Presenting Symptom: Transactions for Certain IE versions were missing entirely
For this particular client, we compared numbers from their back-end system to the eCommerce data that had been collected in GA. The challenge was to diagnose whether it was a technical issue with the website, or rather an issue with the particular Google Analytics implementation. For this type of analysis, it’s important to use an Unfiltered View. We immediately found that some transactions were being excluded via filters and took steps to address that.
But that didn’t fix the whole issue; there were still transactions missing. We then started digging deeper into the differences between transactions that had made it into GA, and those that hadn’t. We created Advanced Segments using Regular Expressions to be able to segment out these two distinct groups and compare reports. We scoured the Audience reports in GA, trying to find commonalities. Finally, the picture became a little more clear. The missing transactions were almost all from IE visitors and most of them from IE9. Something about IE9 was preventing transactions from even being sent to GA.
I’ll spare you most of the things we checked, but go ahead and imagine a montage sequence with furious typing, head scratching, coffee drinking, and an IE voodoo doll. Lightning finally struck when we tried to compare page paths for the missing transactions with page paths for the collected transactions. For the IE9 transactions in question, the Confirmation pages were just… missing.
Diagnosis: Long URLs Were Causing Image Requests to Fail
As I mentioned above, we figured out that it was this perfect storm of really, really long URLs coupled with IE9’s particularly strict URL limit that was causing these hits to fail.
The part that made this difficult to diagnose is that each URL hit contains additional information besides just the URL. So many of the hits would sneak through, while others would just never make it.
Treatment: Change the document “location” before sending the hit
How do you fix the problem without changing the website? Once the page gets to Google Analytics, it’s easy to strip off query parameters using the View settings or custom Filters. In this case though, we needed to remove that particular query parameter BEFORE we sent the hit.
Luckily, we can do this by setting a custom location, then sending the GA hit. It’s important to note that in Universal Analytics, changing the document “path” will only change how the URL appears in Google Analytics, but it won’t change the location that is sent along with the hit.
How to Correct the Issue
Fixing the URL
Setting the Document Location
Use the following steps to correct the issue in Universal or Classic, or if you’re using Google Tag Manager for either.
Universal Analytics: ga(‘set’,’location’,shortenedUrl); set this before you send your pageview
Universal Analytics + Google Tag Manager: under Fields to Set, enter “location” and the macro.
Classic Analytics: _gaq.push(['_trackPageview', shortenedUrl]); this URL is used for the Location and the Path
Classic Analytics + Google Tag Manager: under Basic Configuration, check Virtual Page Path and enter your macro there.
Hopefully, you never come across this issue – but in case you do, now you have the tools to fix it!
About Jon Meck
Jon Meck is our Technical Marketing Manager, promoting our services and trainings to the world. He has a jack-of-all-trades background, working for companies large and small in Social Media, Website Design and Maintenance, and Analytics. He is an Excel enthusiast, he loves efficiency, and he is strong proponent of the "Work Smarter, Not Harder" mantra. Outside of work, Jon enjoys late nights working on pet projects, running races, and spending time with his family.