Skip to content

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
Latest posts by Gary Woodfine (see all)