At a fast-growing media company like
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
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 license, 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.