Sunday, May 24, 2015

Stopping Google Analytics Spammers

Any observant user of Google Analytics will have undoubtedly noticed a large amount of traffic coming from curious looking referrers, like so:

This is worrying! Not only does it completely destroy any chance of getting actual, valid traffic data from Analytics, but it also frustratingly puts your website's data at the hands of internet spammers. Ouch!

So here's a quick tip for stopping the (unfortunately) prevalent Google Analytics spammers from your site.

First, delete and re-add your website to Analytics to get a new property ID, and retrieve your new tracking code.

Next, obfuscate your JS tracking code to keep bots from finding your site's analytics property ID.  I've been using this method for several months now and can confirm that it has no effect on the functionality of analytics and doesn't break anything.