Block in Google Analytics (Referral Spam)

In this article we will explain what is and how to block this Referral Spam from messing up your Google Analytics.

We are assuming you have sought out this page due to some recent rather strange activity coming from something called You own or manage a website and have come to notice that you’ve been receiving a number of visits with literally no session time from the same website, over and over again. Well, regrettably, we’ll have to tell you that you’ve been targeted by what it known as referral spam. This is rather harmless practice that will not affect your site’s popularity, reputation or ranking, but can have devastating effects on your Google Analytics stats. Basically, these fake visits aren’t distinguished by GA from the real ones, which is why the picture painted by your statistics will gradually become completely distorted with false, inaccurate information. However, we will show you how to successfully block and stop the fake data from entering your stats.

Why have I been targeted and what does want?

Referral spam, also commonly known as ghost spam, seeks to popularize a given website by relying on users’ curiosity. This form of spam basically involves creating records of visits (that never happened, mind you) from the website in question and getting you to click back on this visitor, thus generating traffic for that mysterious site.  Obviously, the goal is to increase its popularity and rating, by boosting its listing in Google’s search results. Don’t be fooled into thinking you’ve been singled out for this purpose, oh no. Ghost spammers typically spread their reach to thousands, even hundreds of thousands of sites across the web, with the calculation of even a small percentage of the affected people clicking back to check out the spamming site. As you can imagine, that can already amount to some substantial traffic.

This practice actually evolved from another, similar one, nowadays called classic referral spam, which Google effectively put a stop to. The idea behind it was more or less the same, only instead of merely meddling with your stats, the spammers sent bots and crawlers to actually create visits. This was much easier for the experts to trace, as there were actual views to trace, whereas in the case of, there are none. And this has in turn birthed another issue, rooted directly in people trying to fight the spam themselves.

If you’ve already researched the matter online, you may have come across a number of suggestions related to including the referral spammers in something called the Referral Exclusion list. This is falsely perceived as the correct way of blocking and others of its kind and here is why this is actually a very serious mistake. As pointed out, doesn’t actually visit your page – it only creates that impression in GA. So, what happens when you enter this in the Referral Exclusion list is Google Analytics tries to trace back the visits and, because there are no actual visits to trace, it gets confused. Its confusion results in it not regarding the whole thing as spam, but actually counting those hits as traffic. So, all in all, you went from having messy stats to still having messy stats and on top of that paying for traffic that you don’t have. Conclusion: don’t resort to the Referral Exclusion list for this purpose.


Once you’ve dealt with using the instruction provided below, you will need to do everything in your power to make sure you don’t run into it again. Granted, that may not be 100% possible, as to this date there is no foolproof solution for referral spam. However, you can increase your chances of keeping your statistics accurate and that’s already worthwhile, provided you actually care about having a realistic idea of what goes on with your website and its audience. Your main support in this matter a spam filters and other spam-blocking mechanisms. And those are provided by your hosting. As a rule of thumb, usually the more expensive the hosting service – the better the quality and that includes spam protection, as well. If your current hosting allowed you to land in the situation, in which you are currently in, it may be a good idea to consider changing to a better one. The difference in price will hardly be that big, but it will most probably give you more bang for your buck.

How to 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 *