We're rebranding and relaunching this site in November!

Learn more

How To Filter And Block Spam Websites In Google Analytics

Last Updated on October 6, 2020 by Fabrizio Van Marciano

Are you sick and tired of seeing spammy websites ruining your traffic data in Google Analytics? Well, you're in good hands. Below are some simple solutions you can implement to help you fix this issue.

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

In fact, I work my butt off to ensure that I 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 screengrabs of some of the sites that have been plaguing my traffic data over the recent months.

As you can see, although these sites do bring a minimal amount of traffic, that traffic is, in fact, 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 horrid 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. At least at the time of writing this post.

Sorry, that's a lie. I was able to find a few 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)

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 domain 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
  13. trafficbot4free.pw
  14. automatedtraffic4free.pw

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 the image below.

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

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

Here you can add each of the URLs 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.

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, sorry. The following step involves blocking websites in your .htaccess file. If you're not comfortable with this process yourself, get someone who is experienced or qualified, like your web host provider. In addition, there is no guarantee that the code below will work for your setup. I am hosting with SiteGround (Affiliate Link), so the code works fine in my .htsccess file.

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.

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.

If the code above didn't work, then my sincere apologies to you. You should do further research or contact your web host provider for help.

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.

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


Recommended posts

  1. How To Enable Secure SSL (HTTPS) On your WordPress Website
  2. How To Backup Your Blog Using BlogVault
  3. What Are The Consequences Of Not Updating Your WordPress Website?

Join Over 24,500+ Subscribers

Get fresh content from Magnet4Blogging delivered straight to your inbox, spam free! Or follow us on social media.
pencilcamera-videomic linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram