UPDATE: This post has been updated to include a more precise way to filter out referral traffic. Note that this is not guaranteed to remove all spam referrals as new ones crop up all the time.
Recently, it really started to bug me how much spammy referral traffic was skewing my blog Pageviews on Google Analytics. It was getting to the point where I was seeing big spikes in traffic, and yet the visitor duration for this traffic was pretty much 0.
Whilst seeing bigger numbers of views may feel you with glee, you have to remember that if you have spam traffic coming to your site, these are not real readers.
So what is spam referral traffic exactly?
Basically, it’s traffic coming to your blog from spammy looking URLS. Here’s a few of those that started to appear in my Referrals list:
Plus quite a few more (including some naughty looking URLs!). To date, I have about 15 of these spammy sites trying to direct fake traffic.
Why do they do it?
There are a few reasons, and it depends on the site that’s doing it.
Some sites use it as a lead generation tool. If you visit their site, you will see that they offer their ‘services’ to businesses which are basically spam, spam and more spam. Other sites are part of growing networks with affiliate links, spamming the web to make money.
Why should it matter to me?
Because it skews your data. You might see you have lots of visits to your blog one day, but how many of them are actually readers?
By removing these spam sites, you get a much truer picture of your stats. Sure, big numbers look great, but they don’t guarantee engagement.
So how do I fix it?
It took me a little while to find out the solution, as I was initially convinced that Referral Exclusions were doing the trick. However, I was informed that GA would instead show that traffic as Direct instead of referral, still reflecting inaccurate data.
What we need to do is add a Referral Source filter – this by no means is a 100% fix, and will likely have to be reviewed based on the types of sites that are directing spam traffic your way as mentioned at the top of this post.
Before you get started, ensure that you create a new ‘view’.
Create a new ‘view’ before applying filters
I would recommend that you create a separate ‘view’ for testing any new filters. You can read up on how to do that here. Name the view as something like ‘<url> with X filter’.
You can create up to 50 views of any one property so you can experiment quite a lot. Always keep one view completely untouched to view all ‘raw’ data (i.e. without filters, exclusions etc). This is useful as a comparison to how much difference a filter has made to your data.
How to add filters
The following steps will guide you on creating filters. Remember to apply filters to a new view and not to the raw data.
1. Log in to your Google Analytics account and click on Admin at the top. Select the Account you wish to add a filter to.
2. Go to the View column and ensure the correct view is selected (i.e. the view you named ‘<url> with X Filter’. Then click on Filters.
3. The above table will appear when you scroll down the page. Click on +NEW FILTER.
Et voila, that’s how you create a filter. So let’s take a look at implementing the Referral Source filter.
Referral Source Filter
To create this filter, you’ll need to follow the steps above, and input the following:
You’ll see the next box is titled ‘Filter Pattern’ – this is where things get slightly technical! You need to enter what is a called a Regex (Regular Expression) to tell GA what you would like excluded.
You can tell which URL’s to exclude by going to your Referrals Report and looking at those which are spammy (some examples of spammy sites are at the top of this post, but pop me a tweet if you’re unsure about any other URLs showing up).
The Regex below is a guide (based on some of the spammy referrals I get), and you should add any additional site names or keywords to this code, with a | in between each as this indicates ‘or’:
You can see that there’s a mixture of specific site names and spammy keywords that are included here. Once you’ve added your whole list, click Verify this filter to see how it would have filtered your data over the last 7 days. Not working? Make sure your Regex is correct (you may have a | missing), and try again.
Once you have verified the filter, you cannot re-verify it if you make changes. It’s best to create a brand new filter and delete the old one.
If the filter verification table only shows one or two site visits as being picked up, this isn’t necessarily a bad sign. Leave the filter on for a few days and keep an eye on your Referrals report to see if the spammy sites are still showing up (bearing in mind they will for past data).
If it hasn’t worked, get in touch and I can help you out.