stop referer spam

How to filter referrer spam from google analytics historical data

If you have followed along with any of my previous posts on how to block referrer spam from affecting your website analytics, you have successfully filter out any future spam. However, these measures would not affect any of the historical data. In order to clear out the referrer spam you will need to create a custom segment.

Create a custom segment to filter referrer spam from google analytics historical data

Navigate to your Audience Overview dashboard and ensure you have selected All Sessions . This will display all of the default segments that Google Analytics offers. You are going to + Add Segment


A new screen will display and you then need to click + NEW SEGMENT button

new segment

Create New Segment
  • In the left navigation pane select “Conditions”
  • Change “Include” to “Exclude” in the drop down”
  • Select Acquisition and choose “Source””
  • Select “contains”
  • Enter in the referrer spam domain”
  • to add more domains click or”
  • In the top right adjust the “Segment is visible in…” to your preferred setting. The default is to allow any view in the account to have access to this segment.”
  • Hit “+Add Filter””

new segment

A known referer spammer list

In the right hand column you should see how this new segment will affect the number of sessions when it is in use.   Keeping the All Sessions selected and selecting your new segment will display all the data minus the annoying referrer spammers on your historical data.


Referal spam is not only a nuisance and an annoyance on your Google Analytics, but it is also a threat to your SEO efforts. Ghost Referers although they do not actually visit your site but they do contaminate your statistics.

Referer spam bots do target Google Analytics accounts at random, after they have crawled multiple websites per day and extracting Google Analytics Account numbers from the Google Analytics script embeded in pages, add the Unique Prooperty ID to their database and continually spam your site, making it look like they have sent huge amounts of referral traffic to your site and putting them top of your referral list in Google Analytics.

The referer spam bots will generate fake hits and even Fake transactions on pages.

Google has been trying to combat referer spam for years, and have included some functionality within Google Analytics. However, this is just not sufficient and you will still need to take some action of your own to combat it.

Gary Woodfine

Freelance Full Stack Developer at
Helps businesses by improving their technical proficiencies and eliminating waste from the software development pipelines.

A unique background as business owner, marketing, software development and business development ensures that he can offer the optimum business consultancy services across a wide spectrum of business challenges.

Affiliate Disclaimer

Disclosure: Please note that some of the links included in the blog posts are affiliate links, which means I will earn a commission if you decide to make a purchase.

I only include affiliate links to products, services and companies that I have personal experience and have actually used. I only recommend them because they are helpful and useful, not because of the small commissions I make if you decide to buy something.

Please do not spend any money on these products unless you feel they are relevant, suitable and will help you achieve your goals.

Buying anyone of these products and the commisions earned will not make me an overnite multi millionaire, but they will help to cover the hosting costs and compensate for the countless hours and effort I put in to create meaningful and valuable free content I provide to help others succeed.

You've also undoubtedly noticed that I also use various advertising networks - unless of of course you're using an Ad blocker, this is also an attempt to reduce my monthly deficit I experience in providing free relevant, valuable and on occassion insightful content for the benefit of others.

I only really make some money if people click on the ads, unless of course you consider 1c per 1000 impressions real money!

Bear in mind just how many impressions I need to make before I can cover my £20 hosting costs a month!

If you are using an adblocker and guilt stricken you can of course donate using any of the buttons below, but I won't be holding my breath.

Buy me a coffeeBuy me a coffee