Blocking Google Analytics Referral Spam

Let’s start with the shitlist so far…

And the list goes on. If you have seen any of these in your Google Analytics referral list, you are the subject of GA referral spam. It’s been going on for years, but only recently has it reached a point where the bulk of your traffic showing up in reports is complete junk.

So how does it work? Many initially believe that it was bots actually visiting your site, and triggering GA to record a visitor. This is not the case however, these bots never actually come to your site at all. You see, on your site you will have a GA code that looks similar to this “UA-12345678-1”. All these spammers do is roll through each GA code by increasing the userid by one each time, and then spamming a few hits to each.

So how can you stop them if they aren’t actually coming to your site? Well really Google should step up to the plate and do something about it since really, it’s making their service completely useless. But support of existing products is not a Google way of thinking. Luckily there is a simple way in GA to block them, and albeit it’s manual and it only blocks them going forward. It’s better than nothing.

1. Once logged into GA, at the top of the window should be an Admin tab. Click it!


2. On the far left column, select your account from the top down. Then select “All Filters”.


3. Click the “Add Filter” button. Then fill it out similar to below where the “Filter Pattern” field below is each of the domains you wish to block, separated by a | character, and with a \ character before every full stop.


4. Further down the page you should “select” the views you wish to apply this to. If you have no idea what this means, you should only see one named “All Website Data”, and you want to select this one.

Wallah! You should now be spam free!

So you’re probably saying to yourself that it seems like a lot of work to have to manually join up all these domains, and put a slash infront of the full stops etc. It’s madness you say! Well, I’ve created a Github repo of all the spam domains I’ve come across, and a small tool to join them all together. I hope that in the future, more people will join in so we have a more collaborative list of blocking spam domains. You do need Node installed to run the tool, but hopefully in the future I’ll get around to making it a bit easier for those non technical people.

You can check out the Github repo here :

If you are unsure what the heck you are doing on Github, then the easier way is to just grab the output list here : . Take the second line in that file, and slam it into the block list in GA. And wallah, you have a pretty dang comprehensive spam list. You should check that file often to see if anything new has been added, and just take the entire line again. It makes it a lot more easier than having to maintain your own list!

And of course, for those interested in helping, please create a pull request to add any spam domains to the list so others can benefit from it. The general thought is that if you haven’t been hit my a particular spam domain yet, you still may be in the future, so it’s better to max out your spam list while you can.

Blocking Google Analytics Referral Spam