How To Make Your Google Analytics Data More Accurate: Removing Spam Traffic

How to stop spam traffic on Google Analytics guide

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:

  • best-seo-solution
  • get-free-traffic-now
  • buttons-for-website
  • free-social-buttons
  • floating-share-buttons

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’s 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 is 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.
If you’re new to Google Analytics, you will want to read this basic guide first.

Before you get started, ensure that you create a new ‘view’.

Create a new ‘view’ before applying filters

Creating a new property view on Google Analytics

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.

Select Google Analytics Account in Admin section

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.

Selecting the correct filter view Google Analytics

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.

Create new filter on Google Analytics

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.

Interested in some training in Google Analytics? Or would prefer a live run through on how to do this tutorial? Email me today for more information.

Read Part 2: Advanced Segments

Follow me on Twitter | Follow on Bloglovin | Like on Facebook | Ask me anything



  1. July 22, 2015 / 9:05 am

    Thanks so much for these tips Cat. I've followed your post step by step but unfortunately when I go to verify my filter I get told the source isn't available and to try again later. Not sure if I've done something wrong or if GA is playing up so will definitely try again. x

  2. July 22, 2015 / 5:42 pm

    No problem 🙂 Can you email a screenshot to of the error and what you've entered into the filter pattern? It's much easier for me to see what might be causing it then x

  3. July 22, 2015 / 5:50 pm

    I hope this solution works for you hun 🙂 Let me know how you get on x

  4. July 22, 2015 / 11:15 pm

    Oh, this is really helpful! I've got so many of those spammy websites in my referrals! I'm getting the same 'resource is not available' message when I try to verify too though :/

  5. July 23, 2015 / 7:19 am

    Can you try again today and if the same happens email a screenshot to Not sure what the issue is without seeing it! x

  6. July 23, 2015 / 5:49 pm

    Thanks for sharing this, I'm going to have a go at doing it. If I have any problems, would you mind me emailing you?


  7. July 24, 2015 / 12:42 pm

    LIFE. SAVER. I have recently been spammed with floating-share-buttons and it was really messing up my stats! I would normally only just reach at least 200 each day but last weekend it rocketed to 500 – -i check the referrals and it was from share buttons. You popped your link into a chat so I thank you for doing so 😀

    Much love,
    Lauren "Sweetened Sour" O'Hara

  8. September 7, 2015 / 6:48 pm

    This comment has been removed by a blog administrator.

  9. January 27, 2017 / 11:14 am

    This so helpful thank you Cat!

    • Cat
      January 27, 2017 / 12:53 pm

      You’re welcome! Glad you found it helpful 🙂

Leave a Reply

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