Block Google Analytics Referral Spam

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 quite the nuisance that website owners today, unfortunately, are forced to deal with nowadays. is one of the latest variants of referral spam and we’ve dedicated this article to explaining what it is, what it does and how it does it. In addition to that, though, we’ll provide you with a couple of tips for future use, which will hopefully be enough to steer you from harm’s way. Furthermore, which is probably the main reason you sought out this page, we have created a removal guide to aid you in blocking the spammers and removing their presence from your
GA stats. But before you rush down to that – stick around to learn more about the issue you are now facing. Trust us, it will pay off in the time to come.


We’d like to begin by saying that is a form of what is better known as ghost spam. Ghost spam is a subtype of referral spam and is called that way to separate it from an older type called classic referral spam. There’s also another reason why it’s called ‘ghost’ and not something else, but we’ll get into that in just a little bit. First, let’s explain the origins of referral spam. The point of it all is to generate traffic for a certain website through not-so-honest-means – spam. The spammers would initially send bots and crawlers to a whole lot of other websites. Sometimes these could reach up to hundreds of thousands of sites. So, these bots and crawlers would generate views for the targeted websites. The website owners or admins would see them as visits with little to no session time and, logically, with a near 100% bounce rate. This is done on purpose so as to prompt the site owners to click back on the spamming site. That way they will effectively have generated traffic for it.

Now, today you’re very unlikely to come across classic referral spam as it was nearly exterminated by Google. That’s where ghost spam like comes into play. It was created as an answer to Google’s backlash against the older subtype and doesn’t involve bots and crawlers at all. As opposed to that method, the spammers simply enter false data that depicts visits from the spamming site in the GA stats of yours and other targeted websites. Hence, the term ‘ghost spam’. No actual visits ever happened – they’re phantom visits, if you like. As a result, you see numerous views with no session time in your stats and just as is was with classis referral spam, you click back to see what this strange website is. Now, if left alone, this type of spam is actually far less harmful to your than the bots/crawlers version. Why? Because there’s no actual traffic count and nothing is really affected, but your stats. Over time this can of course become a serious problem, because the fake data will prevent you from having a realistic idea of your actual traffic.

But don’t make the mistake of using the Referral Exclusion list to help yourself. This will essentially lead to more problems than you already have. Because ghost spam doesn’t real create visits on your site (it’s a ghost!), Google Analytics will not be able to detect anything wrong with them. So, by entering into the Referral Exclusion list, you are asking GA to interfere and block these visits as spam. As a result, though, it sees nothing wrong with those visits and instead starts seeing them a legitimate traffic. What happens then, you ask? Those visits will start coming straight out of your pocket, as they will now be affecting your actual traffic count. And there’s not much you will be able to do once this happens. Instead, you should apply the instructions we’ve included below. As for protecting yourself from instances like this in the future, we would recommend upgrading to a better hosting provider. Especially if you are involved in some affiliate marketing network, you become a very easy target for spammers. Thus, it is very important that you have adequate protection and that is what your hosting service provides. Consider this as an investment in your website’s safety and its prosperous future.

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!

About the author


Violet George

Violet is an active writer with a passion for all things cyber security. She enjoys helping victims of computer virus infections remove them and successfully deal with the aftermath of the attacks. But most importantly, Violet makes it her priority to spend time educating people on privacy issues and maintaining the safety of their computers. It is her firm belief that by spreading this information, she can empower web users to effectively protect their personal data and their devices from hackers and cybercriminals.

1 Comment

  • Well, cPanel is basicaly the graphical user interface (GUI) that you use to host and develop your website. It is where you log in when you want to make any changes to the website.

Leave a Comment