I've been curious for a while how other companies are testing their analytics, if they're testing them at all (?!). Viget is doing it by spying on the .push() function that Google Analytics uses to send their beacon calls.
At work, we were doing it that way previously, except spying on the analogous function for Omniture requests as we were using Omniture for the majority of our analytics. While it looks super clean in the Viget article, we found it to be a little messy for our purposes. As best I can tell, Omniture uses different function calls for normal page events vs click events, so we had two different functions to spy on. 1 Plus, we're in the middle of migrating between different analytics providers, so at the moment we've actually got Omniture, ComScore, and Google Analytics on any given page. The pure javascript spy method does wrap up nicely with PhantomJS and the reporters already built, but it doesn't scale very well to multiple trackers.2
What we've switched over to now is the proxy method - in particular, setting up our Webdriver browsers with the Browsermob Proxy in the middle, watching all network traffic that the browser generates. Luckily, we didn't run into any issues with HTTP vs HTTPS traffic, as I wouldn't really know the first place to start with that. But, using a proxy has its own issues - there are a few tricky issues about cleverly determining which request you actually want to look at 3. However, we prefer it because it's guaranteed 100% the actual data that's going to the analytics service, so we can be confident in our test results. Additionally, given our current set up, we need a method that easily applies to multiple analytics groups, and using the proxy that's just filtering against different URL addresses 4 instead of setting up a whole new spy, which would require some intimate knowledge of the tracker code.
Actually, I think we were spying on an in-house wrapper function instead of the actual omniture call, so things weren't nearly as clean as in the linked article. ↩︎
The answer to whether or not we should be using multiple trackers is definitely not!... maybe outside the scope of this blog post... ↩︎
Do we only look at the most recent request? the most recent few? Do we throw away all old requests every time we click or navigate to a new page? What constitutes a new page? ↩︎
Omniture's pattern is /b\/ss/, google's pattern is google-analytics, etc, etc ↩︎













