Skip to main content

Stop Referrer Spam in Google Analytics

by David Brooks | 22.05.2015
If you are a regular user of Google Analytics, it’s highly likely that you’ve noticed what is known in the industry was “referrer spam”. There are a number of prominent spam sites including semalt.com, buttons-for-website.com & see-your-website-here.com. This traffic is generated as a result of a bot in the hope that you will visit the website after seeing it turn up in Google Analytics. Whilst these numbers tend to be extremely low, it is still worthwhile removing them to stop your data from being skewed. There are two methods which you can utilise to remove these:

Block using .htaccess

Warning: The .htaccess file controls how your websites server is handled, an out of place letter or space could result in your website going down. I’d highly recommend liaising with a developer or website administrator before making any changes yourself. Also ensure you make backups of the file before uploading your own version.

Using this method will stop the spam sites from ever accessing your website. Simply copy and paste the following code into your .htaccess file with any sites you would like to block:

## SITE REFERRER BANNING
RewriteCond %{HTTP_REFERER} semalt.com [NC,OR]
RewriteCond %{HTTP_REFERER} buttons-for-website.com [NC,OR]
RewriteCond %{HTTP_REFERER} seoanalyses.com [NC,OR]
RewriteCond %{HTTP_REFERER} see-your-website-here.com [NC,OR]
RewriteRule .* – [F]

Remember to backup your original file before making any changes.

Filter in Google Analytics

Using Google Analytics, you can use filters to hide referral traffic. Although this does not prevent the spam sites from reaching your website, it will prevent skewing of your data.

To set a filter up, first navigate to the Admin, then click on All Filters. Once here, click on “New Filter” & create a Custom Exclude for Campaign Source. Finally, enter the domains you wish to exclude. Use the following format when entering exclusions:

domain. followed by a pipe (|) for each additional exclusion

You may use the following to setup the filter:

darodar.|semalt.|buttons-for-website.

See the above image for an example of what it should look like when complete.