How To Stop Fake Traffic and Spambots From Screwing up Your Website

Okay so you’ve just logged into your Google Analytics account and seen a huge increase in traffic. Awesome!

Hang on a minute, What’s that?

This is where your excitement turns to concern, then total frustration.

Google Analytics is reporting the following sites as referral traffic –


Huh, what the hell is this?

This unfortunately is garbage traffic.

It’s useless, automated rubbish (referred to as “spambots”) slamming your site, potentially hundreds or thousands of times a day – and you need to take action FAST.

What is a Spambot?

Wikipedia defines a spambot as…

A spambot is an automated computer program designed to assist in the sending of spam. Spambots usually create accounts and send spam messages with them.

In other words, it’s software designed to make your life a living hell. Spambots are relentless, very annoying, and most definitely something you need to keep on top of within your Google Analytics account. I’ll cover why below.

Why should I care about blocking these sites?

As a site owner it’s really important you know what’s going on. If you’re running Google Analytics you’ll obviously be tracking things like traffic, conversions, social engagement and more. More importantly, you’ll be looking closely at how well your site is performing perhaps in Google (SEO) as well as your marketing efforts. This is especially important if you’re investing towards paid marketing, traffic, email etc.

Blocking unwanted traffic like this is important for two main reasons –

  • Spambots will distort your data
  • Your site may struggle in terms of SEO

Let’s look at both reasons in more detail.

Spambots will distort your data

Here at Works Media, we always push the importance of site performance – that being, conversion rates. Conversion rates define how well your site is performing for a set goal or visitor action. You may have setup goals within Google Analytics to track –

  • Website enquiries
  • Email signups
  • Sales (ecommerce)
  • ….and so on

Your conversion rate data tells you how well you’re doing overall. That data is tied in as a percentage. So if you’re getting 100 visitors per day, and your site is performing at 2% – this then means you’re getting 2 conversions per day.

When your data is thrown out by spambots and garbage traffic, your conversion rates suffer as a result.

So if you’re now getting 600 visits a day (but 500 of them are spambots) then you’re conversion rates are going to show 0.3%

That can, (at the surface) make you think that something might be wrong with your website, and if you’re not paying attention to referrals, this can lead to you making changes (poor decision making) in hope of fixing something that isn’t necessarily broken.

Your site may struggle in terms of SEO

Over the past few months, there has been healthy discussions going on in many SEO forums, communities and groups, where it is becoming much more apparent that bounce rates *may* directly impact the performance of your site within Google.

This of course means, that pages (or entire sites) with higher bounce rates may not rank as well as sites with much lower bounce rates.

In addition to this, I also published this article here, where I spoke about how Google may be shifting towards silent metrics in order to rank sites. One of those being “bounce rates”.

So if your site is getting smashed by spambots, you could be in some serious trouble, because spambots don’t behave like a normal web visitor. They hit your site and leave within a second or less (see below)


You can see clearly, how useless this traffic really is, and how the engagement times suffer. Bounce rates here are extremely high at almost 96%. If bounce rates really are being used as a potential quality indicator within Google, then chances are if this went on for too long – this site would really suffer.

Why do people do this?

Because they’re assholes. That’s why.

How to stop spambot referral traffic using htaccess

A lot of people often talk about setting filters within Google Analytics to only report on meaningful data. This method involves filtering out reporting so that you don’t see any data from sites like these.

I’ve never really understood this approach (even though it works) but to me, it doesn’t make sense not to fix it properly.

To fix this issue properly, we’re going to set a rule within our htaccess file. That will STOP the traffic at the server, so it will stop completely. There’s no need to be filtering out data within Google Analytics.

Before I continue, I want to stress the importance of this file, and how if you screw it up, it could potentially break your entire site. So if you’re not sure, have your web developer do it for you.

Always, always make a backup copy FIRST, before you do anything, incase you muck something up and have to roll back.

Here, you can copy and paste this directly into your htaccess file. (Just add in any URLs that you need to)

# Block Unwanted Referrer Spam
RewriteEngine on
RewriteCond %{HTTP_REFERER} ^http://.*semalt\.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://.*trafficmonetize\.org/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://.*4webmasters\.org/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://.*buttons\-for\-website\.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://.*darodar\.com/ [NC]
RewriteRule ^(.*)$ – [F,L]

Okay so what next?

For those that aren’t running WordPress, the process is basically the same. Just add that snippet of code above directly to your htaccess file. As already said, be careful because if you get this wrong, you could take your entire site down!

For WordPress users, follow the instructions below.

Firstly, if you aren’t already, install Yoast for SEO.

Be mindful that this isn’t a Yoast tutorial. If you’re not familiar with Yoast or this particular plugin, go here and read up on it before installing it. Don’t just install the plugin unless you know what you are doing – otherwise you stand good chance to mess up all your onsite SEO! Also, do not install this plugin if you are already running another SEO plugin.

Log into your Dashboard and click on SEO, then select Tools.


Then click on “File Editor”.


Then enter the code above (or your own code – amend where required)


Click on “Save Changes” and you should be ready to go.


It always pays to ensure the traffic to your website is of high quality, but more importantly, relevant. If your site is being bombarded with garbage traffic, then its going to screw up your Analytics, which will show in your reporting.

Be sure to keep an eye on spambot referral traffic and action it as soon as possible.

A few other tips –

  • If you’re not sure about editing the htaccess file, get help
  • Always create a backup of the htaccess file before editing
  • Always only ever run ONE SEO plugin. I recommend Yoast for WordPress
  • After editing your htaccess file, check your site for any errors!
  • Maintain a close eye on Google Analytics and Webmaster tools for any further issues
  • Continue to add more URLs (spambots) as they appear within Google Analytics

Also, there’s no better way to get an idea of how your site is doing than with a customised dashboard setup within Google Analytics. This can tell you in an instant if your site needs attention.

You can DOWNLOAD a copy of one that I created some time ago.

4 thoughts on “How To Stop Fake Traffic and Spambots From Screwing up Your Website”

  1. I tried the code you offered above for the htaccess file and got this error for the last line when trying to save it:

    The character “–” (unicode 0x2013) cannot be represented in the “Western (ISO Latin 1)” encoding

    Is there another way to write the last line?

  2. Great, up to a point.

    It’s just that mod_rewrite only blocks webserver traffic. Many spammers just never hit your wesite. They just make javascript calls on the GA code using your tracking ID.

    Unfortunately, the guys at Gogle didn’t find a way to stop this.

Leave a Comment

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