How to block Referral Spam in Google Analytics

The following page was created with the intention of helping webmasters remove the /referral spam in Google Analytics.

A new type of referral spam has been messing up with the Google Analytics statistics of many website owners. This time, the problem that we are going to talk about is called and on this page, you are going to find some effective methods to remove it from your statistics. Below we have included a removal guide with some easy-to-follow instructions, which will help you clean your website from the referral spam and gain back the control to your statistics. In addition, we will give you more details about, and the most important things you need to know about it,  in order to keep your Google Analytics safe from such annoying disturbance in the future. 

What is

Website owners all around the world are commonly facing some issues with their Google Analytics statistics, mostly related to referral spam such as This type of spam usually causes some fake or misleading information in the analytics report, which may not really respond to the real traffic data of the current website. The problem with such referral spam is that the owners and website marketing specialists rely on the information collected by the Google Analytics reports, and when this data has been messed up or replaced with some fake spam traffic, they cannot have a clear picture of the positioning of the website and build a reliable marketing strategy for its development. That’s why removing is a really good idea if you want to have a realistic look at what is happening to your site and keep developing it.

Ghost spam and referral spam – what’s the difference?

When it comes to website spam, we usually have to deal with two types –  referral spam and ghost spam. The classic referral spam uses bots and crawlers in order to visit your website multiple times and immediately leave it. This way it pollutes your statistics and creates huge bounce rate. Such referral spam was widely distributed a few years ago, but fortunately, Google has put significant efforts to restrict it as much as possible. However, the spammers quickly came up with a new and smarter type of spam also called Ghost spam. Instead of using bots and crawlers, it just goes directly to your Google Analytics statistics and messes up with the information there, by simulating website visits where, in fact, there aren’t any.

What is the whole idea behind this spam? The spammers’ goal is to make you click on the spamming website. Once you notice a visitor in your Analytics that constantly comes back to your site and leaves it immediately, you may probably get curious to see who he is. The moment you click back to the visitor’s website, the goal of the spammers is completed. You may end up on a website that has nothing to do with your own, or is a simply some kind of promotional webpage or sponsored site that earns traffic from your clicks. Having in mind that the spam can target millions of websites, this means that millions of curious website owners click on the spammers’ page and this way bring it up in the Google ranking, which is exactly what the spammers want.

How to remove

The longer remains on your site, the more inaccurate your Google Analytics statistics will become, and that’s why we advise you to remove it as soon as possible. However, we should warn you that in your attempts to fix the referral spam issue, you may involuntarily create bigger problems. To avoid that, we suggest you stick to some proven methods in handling referral spam like the ones in the guide below. Of course, there are many other methods available online, such as adding the spam in  the Referral Exclusion list, but they may not be that effective in dealing with and may even do more harm than good to your statistics.

How to keep referral spam away in the future?

Speaking about protection, we have to say that there really isn’t a 100% guarantee that you will keep such referral spam way from your site, but certainly, you can do a few things to minimize these chances. Where you host your website really matters, because the good hosting providers have more reliable spam filters and this way they can provide better protection against such type of disturbance. You can also add some filters and seek for reputed website protection tools.  As a website owner, this should be your first priority in order to keep your important business statistics clean form undesired spam disturbance.

Block in Google Analytics

Instruction #1: Enter your Analytics account.
After that load Admin and then – All Filters.

Instruction #2: After that, hit New Filter.
Next, add in the Filter Name value.

Instruction #3. Choose the Custom Filter Type. 
Once you see the Filter Field, go with Campaign Source.
Next, when you see the Filter Pattern text box, enter Confirm by clicking  the Save button you will see at the bottom.

How to block referrer spam using your .htaccess file

If you are aware of a way to access your .htaccess file, you will just have to write the  code below in there:


RewriteCond %{HTTP_REFERER} [NC,OR]

RewriteCond %{HTTP_REFERER}

RewriteRule .* – [F]

In case you are not aware of a way to access it, follow these instructions:

Access your cPanel account,
the go to File Manager.
After that you should mark the check-box ‘Document Root for’.
Then go to your webpage.
 Another important tip: choose ‘Show hidden Files’.
After that select Go. 
Look for the .htacess file.

Once you find it,  rightclick it.
From the options that appear, select Code Edit.
Enter the code above and Save Changes. 

Hopefully, we have been helpful! Tell us in the comment section. We will be glad to read what your opinion is!

Leave a Reply

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