Have you ever looked in your Google Analytics account and seen lots of visits from strange sites like “semalt” or “buttons-for-website” or even “iloveitaly”?

This is what’s known as referral spam.

These sites are often trying to get you to visit them, either to get your business or maybe even to give you malware.

Sites with little traffic are especially affected by these types of spammers.

A client, for example, may come to you all excited that they got 100 visitors to their site the day before. Looking closely, however, it’s not unusual for 95% or even 98% of those visitors to be referral spam.

Take a look at the top 10 referrals from this site. Only 2 of them are legitimate.




How to Stop Referral Spam


Fighting referral spam, like fighting any kind of spam, is a constant battle.

There are ways of blocking this referral spam inside your Analytics account itself, but the problem is there are always new ones popping up.

Luckily, for WordPress users, things have gotten a little bit easier with a plugin called Bot Block, which was designed specifically to decrease referral spam.

The nice thing about Bot Block is that it tries to keep up on the latest spammers for you. Instead of finding out about them yourself and then going through a somewhat laborious process in Analytics in order to block them, the Bot Block plugin keeps an ongoing database.

And while their database might not catch the very newest spammer on the block, there’s a spot within the plugin’s settings for you to add any site you’d like.

Here’s the setting’s page for Bot Block.


Currently, Bot Block says it has 361 sites on its list.

There’s also a list of referral spammers on Github here. There are 279 sites on that list as of this writing. How much those two lists overlap, I don’t know. But you can always take the Github list and paste it into the Bot Block box for additional domains if you'd like to make sure they're both covered.

But the bad news is that probably won't stop all your spam. Keep reading.


Ghost Referral Spam


Unfortunately, the plugin above can’t stop all referral spam because some spammers never actually show up on your site. It just looks as if they do in your Analytics.

This type of spam is known as Ghost Referral Spam.

There’s a way to eliminate it, and it’s not that difficult, but it does take digging into your Analytics account a little bit.

We’ll go through how to do that below.


Filtering for Your Hostname – Stopping Ghost Spam


In short, what you will need to do is set up a filter in your Analytics account that tells Google to only count visitors that actually showed up on your site.

Here’s the process for that.


STEP 1 – Log in to Analytics and Filter Page

When you log into your Analytics account, make sure you’re on the right account if you have more than one.

Then at the top, go to the Admin view (top menu), and then go to Filters on the right-hand side.



STEP 2 – Create Filter

Once you’re on the Filter page, set up your filter.

  1. Give your filter a name
  2. Choose “Custom”
  3. Choose “Include”
  4. Choose “Hostname”
  5. Put in your filter pattern (i.e. the name of your site – or in Google’s language, your “hostname”)

(Don’t save this filter yet. See Step 3.)



Note: If you have more than one site that’s considered OK for some reason (maybe you’re tracking something on YouTube with your Analytics code, or maybe you also have the domain that is pointed to, then you would want to count both domains by setting it up like this with a straight up and down bar in the middle:|


STEP 3 – Verify Filter

Before saving your filter, you should first verify that it’s doing what it’s supposed to be doing.

Right above the Save button, there is an easily missed link that says “Verify this filter.” Click that.



If everything is working OK, then you should get a result something like the image below where it shows hits before the filter was applied but no hits after the filter was applied.

Note: The (not set) hostnames are typically ghost spammers. Spammers also like to use the hostname these days too. So it’s OK if both of those aren’t counted.




STEP 4 – Save

If everything is OK when you verify your filter, then you can save it.

You should also know that if it’s a brand new site or a site that has very little traffic (even very spammers), then there won’t be enough data for the tool to say that everything’s OK, but it probably is. Just come back and check it later once you’ve got some more traffic.


Stopping the Stat Spam


All spam is bad, of course, but referral spam can really send you off on the wrong track if you don’t account for it or stop it.

It’s a pain, yes, but you really should try to stop it.

Once again, that plugin for referral spam is called Bot Block.

And don’t forget to address the ghost spam too. As more people are catching on to how to block referrer spam, more and more are turning to tactics like ghost spamming.