What is referral spam?
Referral spam is when your website gets fake referral traffic from various forms of spam-bots. There are many reasons why spammers do this but we’ll not get into them in this post.
Why is referral spam bad?
Apart from potentially being a drain on your server resource, for us the most annoying part of referral spam is the inaccurate data you’re left with in Google Analytics. Without an accurate data-set, you can’t make the important decisions to steer your digital marketing efforts.
How do I get rid of referral spam?
There are a couple of options on removing this type of spam from your reports in Google Analytics. Which one you should chose depends on your site’s setup. If you only have a single domain that sends traffic to your site then I’d go for option 2. For those with a slightly more complicated setup and those looking for a more fool-proof solution I’d recommend option 1.
OPTION 1 – FILTER OUT ALL REFERRAL SOURCES
For this method you’ll need to create multiple filters in Google Analytics – as there is a 255 character limit. Currently with our list of referral sources we’ll need to create 3 filters. Each filter will look like this:
Filter Type: Custom
Exclude > Filter Field: Campaign Source
Filter Pattern: RegEx

RegExes To Use
#1: .*((darodar|priceg|buttons-for(-your)?-website|makemoneyonline|blackhatworth|hulfingtonpost|o-o-6-o-o|(social|(simple|free|floating)-share)-buttons).com|econom.co|ilovevitaly(.co(m)?)|(ilovevitaly(.ru))|(humanorightswatch|guardlink).org).*
#2: .*((best(websitesawards|-seo-(solution|offer))|Get-Free-Traffic-Now|googlsucks|theguardlan|webmaster-traffic).com|(domination|torture).ml|((rapidgator-)?(general)?porn(hub(-)?forum)?|4webmasters).(ga|tk|org|uni)|(buy-cheap-online).info).*
#3: .*((event-tracking|(media)?|100dollars-seo).com|trafficmonetize.org).*
Shout out to Ben Travis for putting together the initial list.
OPTION 2 – FILTER OUT FOREIGN HOSTNAMES
For this method we rely on the fact that the vast majority of the spam-bots (the ghost referrals) set a hostname that is not your own. For example ‘google.com’ rather than ‘katteand.co’ in our case. In order to filter these out all we need to do is filter out all traffic with the hostname that isn’t our own.
NB If you know you will be receiving traffic/data from other hostnames legitimately then DO NOT US THIS METHOD. One such example could be if you use your GA tracking code on your YouTube channel, or if you use your GA code on any other domain.
Again we’ll need to create a filter in Google Analytics where ‘website.com’ is your domain:
Filter Type: Custom
Include > Filter Field: Hostname
Filter Pattern: .*website.com.*
And that’s it. Obviously there is our usual warning that filters are non-reversible so always make sure you test them thoroughly and leave at least one view with no filters whatsoever.
They also, unfortunately, won’t apply themselves retrospectively – for that you’ll need to use custom segments. Hot tip: you can create custom segments using the same RegEx code above.
As ever, any questions just comment below!