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

Referral spam is perhaps among the most common problems that websites owners and admins are forced to from time to time deal with. It can be a real nuisance and occasionally, that nuisance can even turn into a genuine threat when improperly handled. That’s not to say that you have anything to worry about at the moment, you’ve not been attacked by a virus and no one is trying to damage your site’s reputation or steal anything from it. But read on and we will explain more about this issue and how you should face it. Today we’ll be looking at a specific representative of referral spam better known as If you have been affected by it, then you might be relieved to know that below is a detailed removal guide dedicated to ridding you of But before you head over to the removal instructions, do spend another few minutes to read what we have to say about this form of online spam.

What is referral spam and how dangerous is it really?

First of all, we’d best make a distinction between classic referral spam and ghost spam. Both are forms of the same thing, only one is older and the other – more popular nowadays. Classic referral spam first emerged a while ago and acted with the help of bots and crawlers. These we employed by spammers with the intention of generating traffic for their websites by means of tricking other website owners into visiting them. This happened by means of sending the said bots and crawlers to numerous websites, which those website owners (admins) would then see as hits. As a result, since the hits were often many and had little to no session time, the admins or owners would click back to check out what this mysterious visitor was and perhaps find out why it had been visiting so often. That way the spamming websites would be gaining more traffic, at which point its rating would receive the needed boost and it would rise up in the Google search results.

Over time, Google was able to put a stop to this and this led to the birth of a new and improved version of referral spam, to which by the way belongs to – ghost spam. The reason why it has earned that name is because the spammers have skipped the use of bots altogether. Instead, they go straight for your stats in Google Analytics and enter data in them, creating the impression that you have been visited by the spamming website. Again, there would be several visits, as you by now have surely noticed, and those visits would have a 100% bounce rate with pretty much no session time. Thus, the principle uses is the same. And in the end, the owners are again prompted to see why it is this mysterious website is behaving in this odd way.

Now, the activity of referral spam isn’t harmful to you in the sense that it doesn’t affect you. The only thing it influences is your stats, and not, for example, your actual traffic count. However, if you, as anyone who cares about their site, think it important to keep a close track of your data, then the presence of things like can really mess that up for you. And the longer you take no action against the spammers, the more distorted and inaccurate your stats will become, thanks to the constant entry of fake data. And this is where people often tend to make the same grave mistake, which leads to even messier consequences.

We’re talking about the use of the Referral Exclusion list, which users tend to resort to as a solution to their referral spam issue. Just because you see the word ‘referral’ in there does not make it a good option! In fact, it’s among the worst things you can do, because all it will end up in is your stats getting even more distorted and on top of that, your traffic count will be affected by, too. Your best option after you’ve dealt with the referral spam as shown here would be to consider investing in better hosting. That way you will be more likely to be better equipped with higher quality spam-blocking mechanisms, which you apparently lack right now, since you’ve been affected by spam.


Block Referral Spam

STEP 1: In your Analytics account go to Admin —> All Filters.

pic 1(1)

STEP 2: Next, click New Filter and add in the Filter Name value.

STEP 3. Select the Custom Filter Type. In the Filter Field —> Campaign Source. In the Filter Pattern text box, add and click the Save button at the bottom of the webpage.

Pic 2(1)

Blocking referrer spam through .htaccess

If you know how to access your .htaccess file, you just need to input the following code in there:

RewriteCond %{HTTP_REFERER} [NC,OR]
RewriteCond %{HTTP_REFERER}
RewriteRule .* - [F]

If you don’t know how to access it, do the following:

Login to your cPanel account —> File Manager —> click the check-box “Document Root for—> your website. A side note: click on “Show hidden Files” and then Go. Find the .htacess file, right click it and choose Code Edit. Input the code I gave you and Save Changes.

Did we help you? A thank you in the comments goes a long way to warm our hearts!

Leave a Comment