How To Stop Referrer Spam

Google analytics is a free web analytics service offered by Google to track website traffic and helps to monitor visitor’s data.

Referrer spam sites are growing day by day. You should filter these spam sites to protect your analytics account in order to get a clear idea about your true traffic details.

In this post, I am going to show you “How To Stop Referrer Spam” in less than 5 minutes.

How To Stop Referrer Spam

Types Of Referrer Spam

Web crawler spam and Ghost referrer traffic are two kinds of referrer spam which will ruin your analytics data and result in increased bounce rate. So if you think that all your visitors are real, you are wrong.

Web Crawler Spam

Web crawlers are robots or spam bots that visit websites and their main objective is to index their content.

These can be identified easily in your analytics reports as sessions with 100% bounce rate with time duration of 0 seconds.

The main objective of Referrer spam is to get backlinks and traffic. Some websites publish web analytics data and this will act as a backlink to their sites and will improve their Rankings.

Never click any website link from your analytics dashboard. If you open any of these URLs in your browser then you will likely be redirected to another site where they try to scam you or try to infect your computer with malware.

You can block crawler spam easily by creating a filter. Copy the list of all the .comreferral spam sites and Create a Regular Expression (REGEX) filter in analytics.

 If you have more than one hostname you can separate them by using “|” and use Backslash “\” before the Dot “.”


Go to Admin – All Web Site Data – Filters – Add Filter – Create New Filter – Filter Type (custom) – Exclude (Campaign Source) – Filter Pattern (Add the List you have created) and save it.

There are some sites which can automatically add filters to your analytics account which is explained below in this article. You need to authenticate Google Analytics account to add the filters to your account and make sure you Update all the filters by authenticating your Analytics account Every week to keep your filters up to date.

Ghost Spam

Ghost referrer is another kind of referrer spam in which they never visit any websites and send fake HTTP requests. This creates a pseudo traffic which means the traffic is not real and hence will increase your bounce rates. And the worst part is, there is No Plugin to block Ghost site. If you want to block Ghost spam, you need to create filters in your analytics account.

How To Block Ghost Referrer Spam

If you want to block Ghost spam, you have to create filters manually. There are some websites which can add filters automatically to your analytics account. These are Free and it will take less than few minutes to install all these filters to your analytics account. Valid Hostname filter and (not set) Hostname filter can block 95% of Ghost spam since most of them are either Fake or not set.

Valid Hostname Filter

You can block Ghost spam manually by creating valid Hostname filter in analytics. Since Ghost spam uses a fake Hostname or no Hostname, you can create a filter with valid Hostnames. This filter is enough to block all the Ghost Spam since Ghost spam uses Fake Hostname.

Go to Reporting – Technology – Network. Choose Hostname as Primary dimension and source as a secondary dimension. Choose Data range – custom (more than 6 months) so that you can filter all the valid Hostnames.

Now pick all the valid hostnames like these ones

Copy all the valid hostnames. Now create a Regular Expression (REGEX) filter in analytics.

If you have more than one hostname you can separate them by using “|” and use Backslash “\” before the Dot “.”



Before adding the valid hostname filter test it with advanced segment.

Go to – Audience – Technology – Network – Hostname and choose Add segment next to all sessions.

add segment

Click Add segment – New segment

new segment

Select conditions on the left-hand side.

segment advanced

Choose Sessions (Hostname) – Include (Matches regex)

Hostname matches regex

Paste the valid hostnames here which is created earlier.


Preview it to see the valid hostname sessions without spam. Save it.

Segment preview

Now create a new filter. Go to Admin – Filters – Add Filter – Create New Filter-Filter Name (valid Hostname) – Filter type (custom) – Include – Filter field (Hostname) – Filter pattern (add valid Hostname Regular Expression you have created).
Valid Hostnames

NOTE: Test your Hostname filter before applying to your filter. Ensure that all the legit Hostnames are included in your filter and check your analytics every week so that you can include other valid hostnames to your filter. If you are not familiar with analytics filters then check the article below where you can add filters automatically.

(not set) Hostname Filter

As you can see in the image Ghost referrer uses not set Hostname and you can check these in analytics – reporting – network – Hostname. You can create (not set) filter to filter these types of spam.

Hostname (not set)

Go to filters – Add Filters – Create New Filter – Filter Name Hostname (not set) – Filter Type (custom) – Exclude Filter Field Hostname – Filter Pattern (not set).

Hostname not set

Block Referrer spam with GM Bot Block

Plugins like GM Bot Block can block Web crawler referrer spam and will send 403 Forbidden message to the referrers that are trying to access your site. This plugin is great for blocking referrer spam. On the other hand, there is no plugin to block Ghost spam, so you must create filters to block it.

Use CloudFlare

CloudFlare blocks most of the Web crawler referrer spam and blocks all bad IPs that create spam. Enabling CloudFlare also helps to increase your site speed and protect your website from hackers and spammers. Usually, sites with CloudFlare get less referrer spam than sites without CloudFlare. You can enable CloudFlare easily in your cPanel or you can add your site manually to their website.

Enable Bot Filtering in your Analytics Account

Enable Bot Filtering

This filters few bad spambots so that your analytics account will not get ruined. You can enable this in your analytics account in Admin – Filters – View Settings – Enable Bot Filtering.

Add a Segment in your analytics with Loganix tool

Loganix created a free Referral Spam tool that filters your analytics spam by creating a segment in your analytics. You need to sign in for their newsletter to get this service free. If you are not familiar with analytics then it is the best way to filter out these spam sites from your analytics. You don’t need to authenticate your account for this tool.

Loganix tool

After confirming email from Loganix you will get a link where you can add the segment to your analytics.

Addon segment

Now choose a view from your analytics account to import and click create.

Choose a View

It will create a new segment in your analytics account. Click save.

loganix spam filter

Now select Add segment next to all users and choose Loganix filter so that you can see the comparison. click apply to see the corrected data along with all sessions.

Add segment

You can see the corrected data now side by side.

corrected data

Updating this segment is quite easy. You will receive a new email when the update is available. Download it and click on it to add the updated segment to your analytics. Delete the old Loganix segment.

Install Filters Automatically by Analytics spam Blocker

Analytics Spam Killer

Analytics Spam Killer is a tool created by Adwords robot which automatically adds filters to your analytics account and keep it as clean as possible.

According to the site, there are more than 35 filters which include

Hostname filter (Hostname=='(not set)’)

Screen resolution filter (Screenresolution == “(not set)’

Domain filter (campaignsourceMatches ‘domain1\.com|domain2\.com|….)

The list includes more than 300 sites and you can submit any referrer spam site so that they can add it in the next filter.

Referrer Spam Killer

Login to your analytics account

Ghost Spam Blocker

Select your website and it will automatically add all the filters in their database to your analytics account.

Install Filters Automatically by Referrer spam Blocker

Referrer Spam Blocker

Referrer spam blocker is developed by an agency in Netherlands and uses your analytics ATI to install filters to your analytics account. New sites will be added regularly so that your analytics are added with updated filters. You can also submit any Ghost spam sites which are not present in their database. These added sites will be updated in the next filter. Make sure you login at least once in a month and check for any filter updates. At present, there are 218 sites and they will add spam sites regularly to protect your analytics account from Ghost and referrer Spam.

Authenticate Now

Click Start Blocking – Authenticate Now.

Select Account

Select all website Data and filters and it will automatically add all the filters in their database to your analytics account.

Install Filters Automatically by

Referrer Spam Help is another website which adds referrer spam and Ghost spam filters automatically. This uses your analytics ATI and installs all the filters to your analytics account. There is no data regarding how many sites are being blocked in this database, but the advantage is that it adds both referrer spam and Ghost spam in the filters to those who do not use any plugins for blocking referrer spam.

Referrer Spam Helper

Click Start Cleaning and Login to your analytics account.

Referrer Spam Helper verify

Click Allow to add filters automatically to your analytics account.

NOTE: Make sure the site is always HTTPS. If the site does not show HTTPS, then never login to your analytics account. These sites mentioned here are all HTTPS sites and they are free to use. Always login every month so that you can update your filters in your analytics account.

This is the only setup you need and it will take less than 5 minutes to complete this setup. You should be able to block 99% of referrer spam with these filters.

4 thoughts on “How To Stop Referrer Spam

  1. Hello,
    you are doing amazing job, really worthy article. i have a qurey, my site got attacked by bots a week ago, bots sending spam traffic and its shows as direct traffic. when i use Google analytics for checking its source , GA show my site url to its hostname. now what should i do ?
    i use many plugins from WORDPRESS, used cloud flare but didn’t solve it. can you please suggest me for direct spam traffic , what should i do for it

    1. Thank You Tayyab. No matter what you do Ghost and referrer spam will be found in your analytics data. So you must clean your analytics data with hostname filter or you can loganix segment which can filter spam referralas.
      Cloudflare can help you from stopping DDOS attacks but it cannot help you to stop ghost spam.
      If you have problems with your analytics data then create a valid hostname filter but you need to update valid hostnames every week to get accurate data.

  2. Ok, can you please give me any video tutorial for make a filter for Ghost traffic in analytics, You explain it briefly in article but a video tutorial worth more.
    and you are right cloud flare can’t block ghost spam. but the thing is if i filter Ghost spam in Analytics. but Ghost spam still damaging my site SEO, because bounce rate is main key for leting google know how much my site has worth for Users.
    Isn’t any way to block this spamy ghost traffic to accessing my site.

    1. You can block Ghost spam by creating a hostname filter. But it takes some time to figure out all the valid hostnames but if you do not want to spend time on that then you can use automatic filters which were discussed in the article. Bounce rate is not a ranking factor and google webmaster told that in a QandA session. If you want to reduce your bounce rate then you can read the article click here

      No matter what you do there is no way to block Ghost spam completely. In the last few weeks a lot of popular sites were also spammed by hackers some of those sites are twitter, reddit, lifehacker… All these sites are popular sites but hackers were able to spam analytics. So you cannot block ghost spam completely the only way to block ghost spam is by creating a hostname filter which should be updated every few days to get accurate data. Do not worry about bounce rate. Focus on quality content and keep your site as fast as possible.
      If its pogo-sticking then you need to fix that because pogo-sticking can hurt your site rankings.

      You can read the article about bounce rate which was mentioned in the comment and you can reduce your bounce rate. I am going to create video tutorials soon and will add the videos to all my articles in the next few months.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.