Exclude semalt referer spam

I have recently noted referer spam in my logs that are also showing in the Google Analytics logs. The site referenced are semalt.com, buttons-for-website.com, best-seo-offer.com, best-seo-solution.com or buttons-for-your-website.com.

The first version of the fix was at the Apache level, but this is a preventinve fix as once you are in there DB. They can continue spamming your Google Analytics account.

The easiest way is to create a filter for each site directly in Google Analytics: Optional title

1. Click on Admin at the top.
2. In the left menu click All Filters
3. For each site to exclude: 
	1. Click +New Filter
	2. Enter the filter name
	3. Click Custom
	4. On the new menu, click Exclude and select the Referrer field.
	5. In the Filter Pattern, enter the domain name, for example best-seo-offer.com
	6. Select all the views you want the filter to apply.
	7. Click Save

Once the rules are set, Google will automatically exclude the spammy referrer sites.

To block the sites using the Apache configuration. Add the following lines to you .htaccess file:

# block visitors referred from semalt.com
RewriteEngine on

RewriteCond %{HTTP_REFERER} semalt\.com [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://buttons-for-website.com.*$ [NC,OR]
RewriteRule .* - [F]

References:

Apache 2.4

Recent Comments