Business Insider Built An Awesome Analytics Validator And You Can Use It

At a fast-growing media company like Business Insider, keeping accurate analytics is absolutely essential. Editors rely on our analytics dashboard to manage content in real-time throughout the site and advertisers need information on the performance of their campaigns. For the tech team, maintaining accurate metrics is a top priority.

Validating analytics is tricky, however. Without real data in a production environment, QA can easily miss subtle flaws, such as analytics pixels that fire sometimes but not always.

To handle this challenge, we built a custom system in Node.js to monitor the site, including development builds through Jenkins. Today, we are releasing that tool to the open source community as an NPM package called Haunted. Using it, you can validate your analytics at both the browser and database level.

Analytics validation at the browser level is done using CasperJS, which loads a “headless” browser in the background without the overhead of a full interface. Given a set of URLs which you expect to be called (the set of tracking pixels you use), Haunted checks to make sure that resources actually get called.

Additionally, Haunted can reach into your database and check that any analytics fields which should be incremented actually are. While Haunted only ships with a datastore driver for MongoDB, it is designed in an extensible way for you to add your own drivers for other datastores.

Haunted is available on GitHub under the MIT licence, and we encourage you to submit pull requests. As Business Insider scales to handle increasing traffic, we on the engineering team look forward to sharing more tips and tools. And we’re always looking for more people to join us.

Business Insider Emails & Alerts

Site highlights each day to your inbox.

Follow Business Insider Australia on Facebook, Twitter, LinkedIn, and Instagram.