Skip to content
Go to the blog overview Go to the blog overview

Removing Spam From Google Analytics

Spam. It’s every internet user’s worst nightmare, appearing in our inboxes, our website comments and now in our Google Analytic feeds. Referrer spam has been creeping into Google Analytic feeds more and more over recent months and it can really have a negative impact on your site and create time-consuming, frustrating issues.

Rather than the generic spam that we all know and hate, referrer spam is slightly more specialised and involves repeated website requests using a fake referrer URL to advertise a certain site – the spam will be indexed by search engine spiders as they crawl a site’s access logs and boost the spam site’s search engine ranking.


So, why exactly is it so frustrating? In short, because it can really mess up your metrics and skew the data that shows you how well your site is performing. Particularly if you are running a small or growing site, your metrics are extremely important to track your audience’s engagement. Your entire content strategy might be based off of your Google Analytics reports, so if the data you receive is skewed because of spam…well, you can see why it creates such a problem.

In addition to devaluing your metrics, referrer spam boosts the SEO of these websites and makes search engine ranking more difficult for everybody else. There’s also the risk that a user may visit one of the spam links out of curiosity and find themselves exposed to malware or other malicious software that could access your electronic data.

Prevention is always more effective than cure, so a strategy worth carrying out is ensure your site is as robust and secure as possible. Spam bots are designed to latch onto vulnerable sites, so making your site an unattractive target can help cut down on spam. Host your site with a well-respected hosting platform who put an emphasis on security, and be careful if you use a custom CMS or shopping cart, as these are often targets for spam bots.

Another suggestion for those receiving lower levels of referral spam is to monitor your server logs weekly and utilise custom alerts to have unusual traffic spikes flagged up so you can analyse where the traffic is coming from – are the visitors legitimate or is it an obvious spam bot? Not sure? Run a quick Google search and see if others have reported the site as questionable – if that’s the case simply block the IP address and move on. Always be careful of visiting the site directly, as you could find yourself exposed to malware or other unwanted nasties.

Rather than spam being something we all have to deal with, we’ve looked into the solutions out there that will help remove spam from your Google Analytics metrics.

Solution 1: Google Analytics View Filters

Analytics Edge have produced a comprehensive, in depth guide to using filters to remove spam from Google Analytics. Covering everything from filtering out ghost referrals to excluding well behaved bots, it’s well worth taking the time to read through their suggestions and then equip yourself with a three deep layer of filters that will keep your analytics as spam free as possible.

Solution 2: Block Bots with .htaccess

It’s worth nothing that, while this option will help with actual referrer spam, it’s not so effective against ghost referrer spam. Still, there is a method to amend your .htaccess file and block spam by IP address and/or by user agent string. The Site Wizard have a great, detailed article that will talk you through each step of the process.

As is always the case when it comes to spam, it’s a constantly evolving unpleasantness which makes it hard to stamp out completely. Spammers are coming up with more and more sophisticated ways to ensure their spam insidiously works its way onto our sites and into our inboxes, so it’s impossible to put a lifelong solution in place that will block every jot of spam.

However, the steps above can drastically reduce the amount of spam clogging up your analytics and are well worth carrying out, not only because your analytics will be more effective but also to ensure your site is as safe and secure as possible.