Keeping your Google Analytics data relevant

The value of web analytics derives from understanding the behaviour of your customers and potential customers.

So if your analytics system is recording visits from sources that are clearly irrelevant to your business it will be much harder to understand what is going on.

Irrelevant visits generally fall into two categories:

1. Automated visits: these are generated by web crawling software.

2. Visitors from outside the geographic area you do business in.

How to exclude automated visits and spam referrals

There are systems that crawl the Internet automatically collecting data from websites. One of the main uses is to collect the information used by search engines.

However, there is an increasing trend for these systems to be used to place a referral URL in your web-analytics system, presumably in the hope you might follow it to see what it is. These are known as spam referrals.

There are several ways of preventing these from showing up in your analytics data. But for the non-technical, here are three straightforward steps you can take to exclude them by using Google Analytics.

 a) Turn on Bot Filtering

From within Google Analytics go to Admin, then select View Settings for the reporting view you use. Three quarters of the way down the page you will see a setting titled Bot Filtering check this to “Exclude all hits from known bots and spiders” like so…

bot filtering

Unfortunately it does not exclude hits from all bots and spiders so there are two more steps to take.

b) Filter out unwanted spam referrals

Example of referrals that you might want to exclude are those from: o-o-6-o-o, forum.topic50575248.darodar, humanorightswatch,simple-share-buttons, blackhatworth, buttons-for-websites, iloveitaly and priceg.

It is possible to create a single filter to exclude all of these, but to do this you would need to list all the different sites. However, most spam referrals can be spotted because Google Analytics records the domain name of the website that triggers its tracking code.

For standard implementations the hostname can only have one value and that is the domain name of your website.

To see the hostname for your referral traffic:

Go to Acquisition / All Traffic Referrals Report

Select the secondary dimension button

Type “host” into the search box

Click on “Hostname” in the green box that will appear.

viewing hostname


This will display a report similar to the following

Source and hostname


As you can see many of these spam visits do not have my website hostname.

So the easiest way to exclude these visits is to set up a filter so that only visits that have your domain name as a hostname are included in your analytics data.

From within Google Analytics go to Admin, then Filters for the view you use for reporting.

Select “+ New Filter

Give the filter a name such as “Restrict visits to my hostname”


Filter Type: Predefined
Include only
Traffic to the hostname
That contain

In the hostname field enter your website domain name (because we have used “that contain” you do not need to add .com or etc.

The filter will look like this…

Restricting to hostname

However, two of the unwanted referrals did use my hostname. To exclude these, set up a second filter that specifically excludes referrals from these websites. The referral web domain will always be recorded as Campaign Source. To create the filter:


Filter Type: Custom
Filter field: Campaign Source
Filter pattern: semalt|buttons-for-website

The filter will look like this…

Anti-spam filter

It is easy to add other sites. The vertical line | represents “or” so just use this to separate the website names.

The system will exclude all visits where the campaign source includes the exact text entered. Be careful not to leave any spaces between the | and the text.

Restrict visits to the country you do business in

The Analytics Doctor website has received visits from over 50 different countries. However, since I only operate within the UK, including these visits gives me a misleading sign of the effectiveness of my website. So I exclude them for reporting purposes.

You can see where your visitors come from by looking at the Audience / Geo / Location report.

To create a filter that will only include visitors from the UK or any other specific country:

From within Google Analytics go to Admin, then Filters for the view you use for reporting.

Select “+ New Filter

Give the filter a name such as “Restrict visits to UK only”


Filter Type: Custom
Filter type: Country (select from the list)
Filter pattern: United Kingdom

UK only

To match UK visitors only it is important you type in “United Kingdom” exactly as displayed here.

Once set the View will only include visits from the UK.

These changes will reduce your visitor numbers, but because the number of irrelevant visits is reduced any statistic based on the total number of visitors will improve. Bounce rate should reduce and conversion rates for goals increase because there is now a smaller total number of more relevant visitors.

Health warning: Always try changes in a test view before applying them to your reporting data.



Icons made by SimpleIcon from is licensed by CC BY 3.0