How to block referral spam in Google Analytics

I’ve recently noticed that a lot of sites I work with are getting fake referral traffic from semalt.semalt.com, buttons-for-website.com, and social-buttons.com. This traffic is clearly all fake as it all spends 0:00 time on sites and has a 100% bounce rate. I tried searching Google for ways to get rid of this traffic, and was met with a whole bunch of articles with other people asking the same question. However, there weren’t really any answers.

What is semalt?

I then looked up what these sites actually are. I found out that Semalt is a SEO business offering free and paid services. They use bots to index the web, the same way search engines do, however, their bots are being counted as users by Google Analytics (although not by Jetpack Site Stats). A lot of people complain about Semalt, and based on their practices I’m not interested in using their services at all, but they actually do offer a way to opt out of the “project crawler” program.

You simply have to submit your site in a form and they will stop crawling it. Easy solution! You can opt out by searching for semalt project crawler. This will give you a page about the project and at the bottom is a form to opt out. I’m writing that out as instructions as I didn’t want to link to Semalt.

Before you do so, please be warned that some people were complaining that the opt out tool made their analytics stop working altogether. Those complaints were made in July 2014. I hadn’t read them when I opted out, and I had no problems after opting out.

Differences between Jetpack Stats and Google Analytics

Just enter your email below!

* I hate spam and will protect your privacy.

to find out more.

How to remove referral spam

I’m still not clear on what the other two referral spammers are (buttons-for-website and social-buttons) but there are several ways to get them out of your analytics. The easiest way is to go into analytics, hit admin, and go to tracking info and then referral exclusion list. In that section, you can add domains to block. You then just hit “create” and in the future those sites won’t count.

Another way to block those sites is in analytics in the “filters” section. Click “add new filter” and make your filter be exclude, referral, semalt.com (or other domain). Again, this works from the time you create it so it doesn’t effect your past stats or data.

There also are some more technical ways to actually try to block those bots in the first place (from mikepricetw.com).Please note, this doesn’t work for all ghost referrals.

Here is the NGINX Rewrite rule which will turn away buttons-for-website.com referral traffic:

if ($http_referer ~* (buttons-for-website.com)) { return 444; }

Here is the Apache htaccess rule to turn away the referral traffic:

# block referer spam

RewriteEngine On

RewriteCond %{HTTP_REFERER} buttons-for-website.com

RewriteRule ^.* – [F,L]

Hopefully this article will help other people that are looking for answers about semalt, buttons-for-website, and social-buttons referral spam.

If you’re looking for a list of referral spammers to block, a github user put together a huge list of 430 referral spam sites.