Over the past several months since we launched this site, I've noticed a couple of domains that keep sending traffic. They've shown up in Google Analytics like so:

I refuse to link to either of these sites.

What really raised a red flag was that our other web properties (including my own personal site) was getting quite a good chunk of traffic from these sites. So a couple of weeks ago I finally did a little digging to find out what those sites were about since they didn't seem to be providing us with any real value.

In doing my research it became clear that that those two sites are pretty much referrer spam sites. They do nothing but hit your site and throw off your analytics. It's a pain in the rear. But there's a way to fix it. Two, actually.

Google Analytics Referral Exclusion List

Google Analytics has a way to exclude traffic from any site you wish. To add these sites, head to the Admin area of your GA account. Then make sure you have the correct Account and Property showing up. Under Tracking Info, click on Referral Exclusion List:

Click on Referral Exclusion List under Tracking Info

Then you'll need to add each site by clicking on the red Add Referral Exclusion button. You'll probably note that your own domain is already in there – Google adds that by default. No need to change that.

I'm a bit overly-cautious so I've added a subdomain for one of the offending sites.

That's it. Those sites won't show up in your GA stats any longer. However, that doesn't stop the sites from sending bogus / bot traffic to your site.

Blocking Sites via .htaccess

The best way to block those sites from sending bogus traffic to your site is to add rules in your .htaccess file. Here's what that looks like:

# Block referrer spam
RewriteCond %{HTTP_REFERER} ^http://([^.]+.)*semalt.com [NC] 
RewriteCond %{HTTP_REFERER} buttons\-for\-website\.com
RewriteRule ^.* - [F,L]
The second line (first rewrite directive) accounts for subdomains, just in case.

If you're not using Apache, you'll need to adjust for whatever your equivalent is.

That's it! Your sites shouldn't receive any more traffic from either of those sites.

——

Update - 12/30/2014

It's been 20 days since this article was posted and since we implemented the suggestions outlined above. And here's what we've experienced thus far.

The filtering in Google Analytics only sort of works. It's really just a way to get it out of view, but we knew that already. It's not reliable for anything else.

Blocking the scummy sites via .htaccess is the way to go. Here are a couple of screenshots of our referrer analytics:

Both images show a complete flatline of traffic to our site after we implemented the .htaccess directive(s).

Additionally, we also noticed a new URL sending us bogus traffic:

This URL seems to be operated by one of the others as it links back to it.

So, we simply added it to our .htaccess file, which now looks like this:

# Block referrer spam
RewriteCond %{HTTP_REFERER} ^http://([^.]+.)*semalt.com [NC] 
RewriteCond %{HTTP_REFERER} buttons\-for\-website\.com
RewriteCond %{HTTP_REFERER} ^http://([^.]+.)*7makemoneyonline.com [NC] 
RewriteRule ^.* - [F,L]

Published on December 10, 2014