How to block or filter referral spam in Google Analytics

Have you checked your Google Analytics reports recently and found referrals from websites such as free-social-buttons.com, www3.free-social-buttons.com, 100dollars-seo.com, guardlink.org, best-seo-offer.com, buttons-for-your-website.com, www2.free-social-buttons.com, www4.free-social-buttons.com….

That’s only some of the websites that gives you fake Google Analytics Visitor reports. It’s called referral spam.

There are a two ways to block this or to get rid of it.

1. Block the URL’s in your .htaccess file
2. Add a filter to Google Analalytics.

Block the URL’s in your .htaccess file

To block these websites or bots from spamming your Google Analytics reports we need to block them. Add the following code to your .htaccess file. You should be able to find this in your public_html folder and if it’s not there, create it.

## STOP REFERRER SPAM
RewriteCond %{HTTP_REFERER} semalt\.com [NC,OR]
RewriteCond %{HTTP_REFERER} best-seo-offer\.com [NC,OR]
RewriteCond %{HTTP_REFERER} buttons-for-your-website\.com [NC,OR]
RewriteCond %{HTTP_REFERER} 100dollars-seo\.com [NC]
RewriteRule .* – [F]

You can add more URL’s as you find them in your referral reports

Block referral spam by adding a filter in Google Analytics

You can also block/remove referral spam by adding a filter to your Google Analytics property.

1. Log into your Google Analytics account
2. Click on the website where you would like to add the filter
3. Click on admin at the top of the page
4. Under view, click Filters
5. Click the red New Filter button

Now select the radio button Create new filter and give your filter a name.

Select Custom, select Exclude > Request URI and in filter pattern add the domain names. You can add multiple domains in this one field. Just split them with a “|”. Ex. best-seo-offer\.com|free-seo-buttons\.com

Here’s an example below. Then click save. You can come back and add new domains to the filter as you find them.