How to Block Referrer Spam in Google Analytics

How to Block 99.9% of Referrer Spam in Less Than 10 Minutes

Implementation Time: 10 Minutes | Difficulty: Easy

A quick search for ‘block referrer spam’ returns over 500,000 results. It is a big problem within Google Analytics, and many people have written long, drawn out guides that are either ineffective or nigh-on impossible to implement without the need for costly IT or technical resources.

Here, we have provided a quick, simple guide on how to stop referrer spam for marketers who just want accurate measurement data that allows them to make intelligent decisions. Is that so much to ask?

This guide covers both retrospective and future data.

Quick Legend: Hostname means domain including any subdomains e.g. or

What is Referral Spam and Why Is It A Problem?

If you are not already familiar with the plague that is referral spam, then put quite simply; it is an incredibly unique type of ‘ghost spam’, which is only visible when you are logged into your web analytics dashboard.

It is designed to impersonate a referral link from a website using something called a spambots;,, and are some of the worst offenders. These and other spam domains pop-up in your analytics data in the hope that you’ll visit their site.

There are two key reasons that referral spam is such a problem:

Firstly, these spurious visits skew your Google Analytics data. For monster sites such as the BBC and Mr Porter, it is not as much of an issue as they receive a huge number of daily sessions, of which referral spam is a minuscule proportion. In contrast, for a north-east artisan bakery, if they get around 40 sessions per day, then three-quarters of it will probably be spam referrer traffic. This has a huge impact on marketing analysis, as the unreliable data thwarts sound decision making.

Secondly, these spam referral visits chew up your server resources on something that you do not need, and most importantly, that you did not ask for. Doing this runs the risk of overloading your server, which results in slower load times for your site, and therefore, higher bounce rates and lower rankings.

Block 99.9% of Google Analytics Referral Spam from showing in reports;

Step 1 – Log into Google Analytics, find the view you want to fix, and go to Admin > Filters.


Step 2 – Add a new Filter, name it something like ‘Genuine Hostnames Only’. Select ‘Predefined’ then ‘Include Only’, ‘traffic to the hostname’ and ‘that contain’. Enter your domain into the hostname field; we would recommend putting the domain with any subdomains (see screenshot below):


Step 3 – Click Save. If you have the same tracking code on multiple domains, repeat step 2 for each domain or setup a custom regex filter (but that is a different guide for a different day).

Done! To quote a ubiquitous anthropomorphic Russian meerkat: simples! A significant amount of your referrer spam will now be blocked from your reports moving forward.

How to retrospectively remove Google Analytics referrer spam from reports

Step 1 – Go to any standard report in Google Analytics.


Step 2 – click on ‘+ Add Segment’ and Click ‘New Segment’



Step 3 – Name the segment something like ‘Genuine Hostnames Only’ and select an advanced condition to only include sessions where the hostname is your domain.


Step 4 – (Optional!) if you have multiple domains, use the ‘or’ button to add multiple conditions or setup a regular expression rule.


Done. It wont work on every report, but it’s a quick way to strip it out and see true data retrospectively.

Remember, if you apply a different segment to your reports, it will include referral spam within it unless you add the same conditions that you added to the hostname segment in step 2.

Disclaimer: This is a solution we use, alongside others, to remove most referral spam. Currently, there is no solution available that will remove 100% of referrer spam, but some solutions are more effective than others, and we find this one to be the more potent.

We also add filters to block individual cases of referral spam and find this is very effective for our clients.

Did this solution work for you? Do you have a better solution? We would love to hear about it! Tweet us @digitalalliesuk or drop us an email [email protected]


The Digital Allies newsletter brings you free resources and new thinking about all aspects of digital marketing. By signing up for it you will get notice of our events before anyone else and we will only be in touch if we have something that we think you will be interested in.  You can unsubscribe at any time. See our privacy policy for more information on how we take care of your information.