Stop Referrer Spam in Google Analytics
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.