Block Google Analytics Spam

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 this page due to a recent encounter with referral spam, then you have found the right one. Here we will show you how you can successfully block the spammers and rid yourself from the nuisance. For that purpose, below this article you will find a removal guide that should do just the thing. It’s in step-by-step format and will walk you through the process of removing the spammers from your stats. However, please take the time to read through the next few paragraphs, as they offer important information regarding the nature of referral spam. We will also address common mistakes that website owners make in their desire to combat and others like it on their own.

What is and what it does is what is also known as ghost spam. It’s a subtype that distinguishes it from an older form of referral spam called classic referral spam. The two are essentially after the same thing, and even use pretty much the same means to achieve it, with the exception of one small detail. Both forms of referral spam seek to popularize the spamming website, by attracting more traffic to it. This effectively boosts that website’s ranking. In the case with classic referral spam, the spammers would send bots and crawlers over to thousands of other websites to imitate actual visits. These visits would appear in the stats of those websites with little to no session time and in most cases, there would be a whole number of them. So, the idea is to get the website owners or admins to notice this peculiar activity and get curious enough to investigate. And by investigate we mean simply click back on the spamming site to see what it’s all about. And there you have it: the spammers have reached their initial goal, as the website owner just generated traffic for them. So imagine this happening on a way more massive scale.

Now, Google was able to pretty much put a stop to this activity. And that’s when ghost spam appeared. The spammers realized they needed to find a workaround to continue with their unfair play and they did. So, they skipped the whole bot and crawler thing, as that is what will get you caught. And instead, they went straight to people’s statistics in Google Analytics. Brilliant, right? So now, as opposed to actually creating visits, spam like sees to it that you only get that impression. In effect, they enter false data into your stats and that’s all. Your actual traffic count is not affected, your ranking and such don’t suffer from this – you are only tricked into believing so. In that sense, is less harmful than classic referral spam, but failing to remove it will still result in issues. In fact, the longer it keeps manipulating your stats, the more distorted they will become and over time you will lose perspective over you actual viewings. That’s not something you want.

However, we should warn you against resorting to certain measures that will get you into even more troubles. One such measure is the Referral Exclusion list. It’s a very useful and convenient tool, but it’s not meant to block spam. If you search enough about this online, you will be bound to land on a bunch of wise guys advising you to enter the spammers in the exclusion list, as if that will solve the issue. It won’t. It will make matters worse, because in doing so you will be basically asking GA to go and follow up on the visits you’re reporting. And remember what we said earlier about there not actually being any visits? Well, GA will try to trace them back and because they never happened in real life, it will not be able to detect anything. So, as a result, it will mark them as real traffic. And at that point, it won’t just be your stats that are affected anymore – it’ll be your traffic count, too. So, unless you would like to start paying for imaginary views as well, we suggest you do not employ the help of the Referral Exclusion list in this fight. Just use the removal guide we’ve provided below and consider investing in some better protection against spam from now on. Upgrading to a better hosting service will most likely also ensure higher quality spam filters and other spam-blocking mechanisms.

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.


Leave a Comment