Block Referral spam in Google Analytics

The referral spam in Google Analytics is a new breed of problem. This page is dedicated to eradicating it from your GA statistics.

If you have found yourself being harassed by referral spam called, then you’ve come to the right place. Here we will aim to tell you all about what this referral spam is, what it does and how it does it. Furthermore, we’ll also tell you just how much harm it is capable of inflicting on both you and your website. But what’s more important, we will also provide you with a set of instructions, which will help you get rid of and free yourself from its presence. You will find those under the removal guide below, but before you head on to the instructions, we would recommend that you read through the following information first.

What does referral spam represent and how does it operate?

First, a little history. Don’t worry, this won’t take long and is only necessary so you can understand what is really doing to you. To begin with, referral spam initially emerged in the form of what we now call classic referral spam. Basically, what this meant was that spammers would employ the help of things called bots and crawlers, so as to spam various different websites. They would program those bots and crawlers to generate hits on as many sites as possible, numerous times per site even, and with virtually no session time. This was done to prompt the website owners or admins to get curious enough so as to click back on this visiting websites and find out why it’s been opening their site and leaving it immediately after. And even if this didn’t succeed with everyone, you can imagine that even a fraction of the hundreds of thousands of targeted sites would still be able to generate sufficient traffic for the spamming website. And that is precisely what they aim to do: boost their rating by gaining more traffic, even if it’s through such a dishonest scheme.

After a while Google was able to catch on to this practice and eventually put a stop to it. And that’s when versions like started to appear. These are now known as ghost spam and are the new and enhanced version of the classic referral spam. They don’t require the use of bots and crawlers, unlike their predecessors. Instead, they go for your Google Analytics stats directly. That way they can simply make the impression that you’ve been visited numerous times by the spamming website, as opposed to having to make those hits. The good thing about this is that nothing but your stats is affected. This means that your actual traffic count and such remain untouched, so in other words – on the outside it’s like nothing ever happened. On the flip side, though, you may find it both annoying and hindering that your stats are getting polluted by all this fake data that keeps on getting entered by And that may, in fact, prove to be a problem, especially over time.

And this is usually the point where users make rash, uninformed and harmful decisions. One such decision is using the Referral Exclusion list as a means to block the referral spam. Because it contains the word ‘referral’ in it, right? So it must work! Wrong. Not only will it not help you remove the spam from your GA stats, it will actually worsen the issue and will cause you a whole lot more headache than you ever bargained for. First off, that’s not what the list is meant for. Secondly, once you enter the spammers in it, it will prompt GA to investigate the visits you’ve reported. But seeing as there were no visits to begin with (ghost spam, remember), it won’t be able to do anything about it and will go a step in the opposite direction by marking those visits and genuine traffic. Congratulations, now you will have them added to your actual traffic count.

Don’t cause yourself the extra trouble by going down that route. Instead, use the removal guide we’ve created for you below and have the issue done with. Your best shot at avoiding such future harassment from now on would be to consider switching to some better quality hosting. It is likely to provide you with better spam filters and, therefore, with better protection against referral spam like

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!

One Reply to “Block Referral spam in Google Analytics”

Leave a Reply

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