Block ghost referrals from Google Analytics (resources)

August 15, 2015 1:48 pm
Published by
Leave your thoughts

Over the past year or so I’ve noticed ghost referrals having a significant impact on many of the Google Analytics accounts I look after. Fortunately there is some quality information already out there to help you prevent this annoying spam from contaminating your data, so rather than re-hash what’s already been written, here’s a summary of some of the most useful resources I’ve found. First up is a comprehensive post by Mike Sullivan at Analytics edge – this is probably the best place to start as Mike takes the time to explain the different types of spam referrals and the techniques to tackle them. This will help you to understand how spammers are hitting your site and why there isn’t a single catch-all solution to block them all. Just don’t forget to set up an unfiltered view and testing view before implementing any of the recommendations – trial all the changes on your test view first and refer back to the unfiltered view if things don’t look quite right, it will save you time and heartache!
Analytics Edge: Definitive Guide to Removing Referral Spam
Once you understand the different ways spammy referrals get in to your account, and depending on the severity of your issues, you might decide to try and stop as many of the worst offenders from accessing your site at all. This is where a .htaccess solution comes into use – by blocking the most obvious spammers you can save wasting bandwidth and server resources on junky visits, but with so many new spammers popping up all the time it’s difficult to keep on top of. Luckily there’s a GitHub repository created by Stevie-Ray dedicated to exactly that: compiling a shit-list of all known bots and spiders. Simply grab the code and drop it into your .htaccess file and you can prevent the majority of known spammers from even getting to your site. However a word of caution if you are unfamiliar with editing your .htaccess file – always test the code carefully: an invalid dot, dash or space in the wrong place could render your entire site inaccessible, not good!
GitHub: Apache and Nginx files to prevent referral spam traffic on a server leve
So you’ve tackled spammers that visit your site by blocking them in the .htaccess file, and you’ve filtered out ghost referrals which never even visit your site – are you done? Not necessarily. Ghost referrals that don’t visit your site essentially spoof your tracking ID in order to get the data into your account, for the most part however they do not set the hostname to match your domain (where your GA code is installed) hence using the valid hostname filter in Mike’s article above excludes them from your reports. The problem is they can just as easily spoof your hostname too – in this case the hostname would be valid, the traffic will bypass your filter it will be impossible to differentiate from your normal traffic! So what now? In order to ‘validate’ the traffic you need to employ a mechanism to ensure the user has actually visited your site – the most obvious solution is to cookie them and then verify the cookie exists before counting that traffic in your reports. It’s not a bullet-proof technique, but as Sayf from LunaMetrics explains it should provide and extra level of protection against ghost referrals which are passing both a valid tracking ID and hostname:
LunaMetrics: Eliminating Dumb Ghost Referral Traffic in Google Analytics

Categorised in:

This post was written by WillyNilly

Leave a Reply

Your email address will not be published. Required fields are marked *