• Blog >
  • How to remove spam traffic from your google analytics

Over the past 12 months we’ve seen an increase in spam traffic showing up in Google Analytics (GA). This article will look at several ways to help you get rid of that spam and help prevent it in the future.

We’ve seen it across our site and a few of our clients’ sites, showing up as referrals that don’t actually exist. It’s becoming a problem and I’m sure if you go to look at your referrals it’s more than likely that you will see something similar.

The culprit is the infamous Vitaly Popov, who owns a network of spammy domains such as: darodar.com, econom.co and ilovevitality.co. Whilst, other common spammers we’ve seen include: semalt.com, buttons-for-websites.com and see-your-website-here.com.

Using .htaccess to block spam bots

Jared Gardner’s article discusses how to prevent these bots from accessing your site by blocking them in your .htaccess file. For example:

## STOP REFERRER SPAM 
RewriteCond %{HTTP_REFERER} semalt\.com [NC,OR] 
RewriteCond %{HTTP_REFERER} buttons-for-website\.com [NC] 
RewriteRule .* - [F]

This method is great because it stops spam bots from hitting your server altogether but please note, this won’t solve all of the problems. What it will do is protect you from future sessions.

There’s also a WordPress plugin for those of you on a WordPress website. WP-Ban allows you to ban users by IP, IP range, host name, user agent and referrer URL.

Using filters in GA to block spam

As well as these bots hitting your site, there’s another kind called ghosts. These ‘ghosts’ send data directly into Google Analytics’ server, targeting randomly generated UA codes and therefore causing these fake visits/referrals. Because of this, they either don’t set a hostname or use a fake one.

Since these ‘ghosts’ never actually visited your site, you can’t block them using the .htaccess method, but there is another way. Following Carlos Escalera’s guide we can create a filter that will only include hits that use real hostnames. To create this filter, you first need to look at the report of hostnames in GA:

  1. Go to the reporting tab
  2. Click on ‘Audience’ on the left hand side
  3. In technology select ‘Network’
  4. At the top of the report select Hostname

This will show you a list of all the hostnames, so make your own list of all the valid ones you find and use them to create a regular expression to then filter out of GA. When creating your custom filter select ‘include’ and ‘Hostname’, then copy your regular expression into the ‘filter pattern’ box and hit save.

Conclusion

We hope this helps get rid of some of your spammy traffic in GA, however, if you have any questions feel free to get in touch. Our marketing team are experts in using Google Analytics and are on hand to help with any problems you may have.

We offer Google Analytics Training day courses if you'd like to learn more:

New Call-to-action

● ● ●