How To Filter And Block Spam Websites In Google Analytics

Last Updated On

I'm sick and tired of seeing spammy websites ruining my traffic data in Google Analytics! If you feel the same and are looking for a few simple solutions to fix this issue, try some of the tactics outlined below.

When I look at my Google Analytics data, what I like to see is traffic coming from relatively good, clean, and reliable sources.

In fact, I work my butt off to ensure that I do get traffic from credible and authoritative sources, as I'm sure you do too.

What I don't like to see, however, is my traffic data spoilt with spammy websites, I'm sure you're getting a few of those too.

Annoying, isn't it?

What kind of spammy websites do I mean exactly? Well, take a look below -

  • Ranksonic
  • Semalt
  • Buttons-For-Website
  • See-Your-Website-Here, and all the rest of it!

Here's a couple of screen grabs of some of the sites that have been plaguing my traffic data.

  • Save

  • Save

As you can see, although these sites do bring a very small amount of traffic, that traffic is in fact utterly worthless. You can see that just from the bounce rate.

These are just a few of the sites that have been ruining my reports in Google Analytics, and I'm well aware that there are plenty of other crappy sites like these out there.

So, what is the simplest solution?

Before I decided to write this post, I couldn't find anything remotely useful or helpful on the web about tackling website traffic spam.

Sorry, that's a lie. I was able to find a few mediocre articles with some suggestions, but some of the advice shared on those articles were either hit or miss.

Anyhow, I decided to write an article of my own to cut a long story short, and hopefully, mine will help you and countless others who are experiencing the same kinds of issues with spam and their website.

Let's do this!

Two methods

I'm going to share with you two methods.

The first method is to filter those unwanted websites in the Google Analytics admin.

The second method is for blocking websites permanently in your .htaccess file.

1. How To Filter And Block Spammy Websites In Google Analytics (Admin)

So, in this process, we're going to get rid of the useless traffic data and bots generated from these websites from ever appearing in your GA reports once and for all.

Note, this will not remove the sites from your historical traffic data, only the future.

Step One: Make a list of all the spammy websites

The first step is to make a list of all the websites that are skewing your traffic data.

Take a look at your report for the last 6 months or more, and carefully find those retched sites with high bounce rate and zero time on site.

It shouldn't be too hard to do as most of these sites often have long or odd names. But, to save you a whole lot of time, I've started to create a list here for you. You can always add to it.

  1. semalt.com
  2. ranksonic.com
  3. darodar.com
  4. econom.co
  5. ilovevitality.info
  6. buttons-for-website.com
  7. buttons-for-your-website.com
  8. see-Your-Website-Here.com
  9. best-seo-offer.com
  10. 99-reasons-for-seo.com
  11. backlinks-fast-top.com
  12. octa.com

I will update this list as and when I come across them in my own GA reports.

Step Two: Blocking in Google Analytics

Once you have your list ready to go, log into your GA account, head over to Admin > Property > Tracking Info for the site who's traffic data you want to clean up in the future. See image below.

  • Save

When you click on Tracking Info, a drop-down menu should appear, on this menu select "Referral Exclusion List". See image below.

  • Save

In the next column, you'll see is the Referral Exclusion List.

In here you can add each of the URL you want to exclude from your future Google Analytics report. Simply click + Add Referral Exclusion to get started. See the image below.

Once you've added all of the sites you want, you're done, just head back to reporting.

  • Save

Note: Again, this process does not block any spammy sites from accessing your website, nor does it remove them from your historical traffic data. What this process does is stops these sites from appearing in your future referral data. Since blocking these sites on my own website, I've not seen any of them appear in my GA reports.

2. Blocking Websites In Your .htaccess File

OK, so if you want to block these sites from accessing your blog completely, like forever and eternity, then follow the steps below VERY CAREFULLY!

Warning and disclaimer: I need to cover my butt here. The following step involves blocking websites in your .htaccess file. If you're not comfortable with proceeding with this process yourself, then get someone who is experienced or qualified, like your web host provider.

Blocking via .htaccess is by far the best method for preventing spammy websites from accessing and appearing in your GA reports.

Does this method work?

In my case, it did work. Hopefully, it will work for you too.

Backup first

Before you start, please make sure you've made a backup copy of your .htaccess file first, before making any changes or modifications. This is critical because one mistake and your site WILL crash. With a backup copy of your .htaccess file, you can restore it quickly without any problems.

All you need to do is copy the contents of your .htaccess file and paste it into a blank .txt file to save on your computer.

OK troopers, let's begin.

You will need to access your .htaccess file via your cPanel in your web host.

Step One: Find and access your .htaccess file

Log into your web hosting account and head over to cPanel.

If you're using Bluehost or SiteGround, just log into your hosting account as normal, then head over to cPanel > File Manager (under file management).

In file management, double click on the website name you want to access the .htaccess file for.

Now click on the .htaccess file itself and click "Edit".

A pop-up box should appear alerting you what you're about to edit.

Hit the Edit button and a new tab should appear. You're now in your .htaccess file, editing mode. You can officially begin to sweat...

OK, just kidding, you'll be fine. See image below.

  • Save

Accessing your .htaccess file via other hosting providers should be relatively similar as long as a cPanel is provided.

Step Two: Paste the 'blocking code' below

Again, make sure you have made a backup copy of all the contents in your .htaccess file.

Then, copy the code below and paste it at the bottom of your .htaccess file page:

# Block visitors referred from these spam websites
RewriteEngine on
RewriteCond %{HTTP_REFERER} semalt.com [NC]
RewriteCond %{HTTP_REFERER} buttons-for-website.com [NC]
RewriteCond %{HTTP_REFERER} best-seo-offer.com [NC]
RewriteCond %{HTTP_REFERER} darodar.com [NC]
RewriteCond %{HTTP_REFERER} see-your-website-here.com [NC]
RewriteCond %{HTTP_REFERER} buttons-for-your-website.com [NC]
RewriteCond %{HTTP_REFERER} econom.co [NC]
RewriteCond %{HTTP_REFERER} ranksonic.com [NC]
RewriteCond %{HTTP_REFERER} ilovevitality.info [NC]
RewriteRule .* – [F]

For your convenience, I've added the websites I mentioned at the start of this post to the list.

If you want to add a new condition (website to block), simply copy and paste:

RewriteCond %{HTTP_REFERER} enter-website-here.com [NC]

This needs to go before the:

RewriteRule .* – [F]

Don't forget to change the part that says enter-website-here.com marked in red, with the URL you want to block.

Once you're done, double check that everything is in good order and hit save.

Check to ensure your website hasn't crashed and burned, if not then you're all done! Nothing more to worry about.

My website has crashed, what should I do?

Relax, chill, you made a backup copy of your .htaccess file, remember?

If your website crashed and burned during this installation, simply delete everything in your .htaccess file, and paste the entire backup copy of your .htaccess back into the file and hit save.

I would also love to hear from you if this didn't work so that I can take a look at the code, and my own code in my .htaccess file to make sure everything is in good order.

OK peeps, I hope this little tutorial was somewhat useful for you, if you have any questions, please contact me via my connect page.

Enjoy!

  • Save

Enjoyed reading this post?

Hey! Thanks a bunch for reading this post, I hope it was of value to you. I publish new posts every week, so be sure to check back soon, or hit the button below to subscribe.
subscribe to updates

7 comments on “How To Filter And Block Spam Websites In Google Analytics”

  1. Hi Fabrizio,

    It's amazing that over the last two months it felt like these spam sites came out of nowhere. It was really interesting and also really frustrating.

    I actually blocked most of them through the .htaccess file for the larger ones and that worked like a charm! For the smaller ones I chose the GA filter.

    I can't help but wonder if they weren't also slowing down my site some? Not sure but it makes sense and now the site is loading much faster again.

    Great post Fabrizio, I appreciate your insights and will be sharing this on my social media as well as my upcoming addition of Rewind Saturday!

    Have a great week!

    ~ Don

    1. Hey Don, appreciate you stopping by this post, for me too some of these sites I've noticed making more and more of an appearance. The sad thing is you block one, and another appears, and another and another.

      For sure if you have a lot of hits from a bunch of these sites, cookies, spam yeah your server does get hit and that's costing you and me money.

      Glad you enjoyed this little tutorial this week, have an awesome week ahead too buddy!

    2. Hey Don, appreciate you stopping by this post, for me too some of these sites I've noticed making more and more of an appearance. The sad thing is you block one, and another appears, and another and another.

      For sure if you have a lot of hits from a bunch of these sites, cookies, spam yeah your server does get hit and that's costing you and me money.

      Glad you enjoyed this little tutorial this week, have an awesome week ahead too buddy!

  2. Hey Fabrizio,

    I've noticed a few in my analytics as well for some time now. Not the same ones you've mentioned though.

    I would think that unless you block them from accessing your site then whether they show up on your report or not, they're still going to hurt your results right! You just won't be able to see where that source of traffic is coming from.

    I think that these unworthy sites are really the norm for most of us. Just trying to link to us and be spammy, I think they must get a charge out of that or something. I'm sure it's not benefiting them in any way.

    Thanks for sharing this because I'm sure most don't know how to block them in the htaccess file. I learned that several years back thank goodness.

    ~Adrienne

  3. Hi Fabrizio,

    I only just spotted this post on your site.

    I just published my own post around this topic because I was getting so 'hacked-off' with the GAS - Google Analytics Spam. Its just so frustrating and I think Google should really get their act together on this one.

    Thanks for your tips above. I preferred not to change my 'htaccess' file and installed a simple plugin instead. But like you say that's just half the battle - you need filters as well. I also Clicky which is clean!

    Cheers
    - David

Read Commenting Policy
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram
Share via
Copy link