Digital Marketing

Clean Up Google Analytics Referral Spam

Google Analytics is a wonderful tool, and when set up well it delivers a variety of highly accurate data about how people visit and use your site. However, one of the few areas where this accuracy can be compromised is referral traffic. If you need a quick reminder, this is the traffic that should come from a person naturally clicking on a link from a different domain to yours. Unfortunately, thanks to the ubiquity of spam, this traffic may not be what it seems. So, how can you clean up Google Analytics referral spam?


What is Google Analytics Referral Spam?

Simply put, referral spam consists of non-natural actions that get categorised as referral traffic to your domain. In other words, not a person that happens to click through to your site.

There are two main types of referral spam. Firstly, there are web crawlers that don’t identify themselves as bots, so aren’t excluded from Google Analytics. Secondly, there’s “ghost” referral traffic, in which spammers spoof sessions by sending fake HTTP requests. There are several reasons why someone might do this, one of which is – believe it or not – to advertise to the person viewing the report.

While there were some reports earlier this year that Google is starting to automatically filter out a few common referral offenders, a significant amount of spam can still make it through to your data.


Check for Referral Spam

So, how do you know if your data is suffering from a spam infestation? If your referral traffic seems abnormally high and/or you notice a sudden spike, it could be an indication that some of your referral sessions are spam.

To check for referral spam in your Google Analytics reports, first go to the Acquisition section, then All Traffic, and open up the Channels report.

Google Analytics Referral Traffic

From there, click on the Referral grouping to bring up the list of referral sources.

Google Analytics Referral List

Referral spam is often easy to spot if you know what to look for, especially when you consider the sorts of domains you’d expect to see linking to your site. As in the example above, sites with uncommon top-level domains (e.g. “.xyz”) tend to be spam, as do domains containing phrases such as “SEO”, “traffic”, “search”, “tool”, “rankings” etc. A 100% bounce rate is also pretty suspicious. You can always visit the site if you’re still not sure.


Exclude Referral Spam

So, you’ve discovered that you’re suffering from referral spam, which is skewing your overall analytics data. This is particularly problematic if your legitimate referral traffic is fairly low- just a few extra spam sessions would cause Google Analytics to show a significant percentage increase that doesn’t really exist. But how do you exclude it?

The first way is to simply visit the referral sources report (shown above), and manually subtract the spam traffic from your total referral sessions. This is pretty easy to do, but it doesn’t exclude the data from Google Analytics (so it could still affect other reports you look at), and you’d have to do it every time you want to gather/analyse your traffic data. It can also be a real pain if there are many different spam domains generating referral traffic to your site.

The second way is to actually exclude the spam domains from your Google Analytics reports. This is the most effective option, although it’s still worth checking your referral sources every now and then to make sure no new spam is coming through. There are several approaches to blocking this data, including fairly complex Google Analytics filters and even modifying your .htaccess file. However, we’ll just go into a couple of fairly easy (and still reasonably comprehensive) ways to achieve this.

Before anything else, the simplest thing you can do is tick the box marked “exclude all hits from known bots and spiders”, located in your view settings. This will exclude any bot traffic from a useful but non-exhaustive list. After you’ve done that, one of the easiest (and least risky) ways to exclude domains you’ve identified as spam is by setting up a segment. Importantly, a segment can also be applied to your historical data, unlike other methods which only affect data going forward (e.g. filters).

Firstly, click on the Admin tab at the top of Google Analytics, and select Segments under the relevant view.

Google Analytics Segments

Then click the New Segment button to bring up the segment creation screen. From here, select the Conditions tab on the left- this is where we’ll set up the segment. Change the dropdowns to Exclude a Source (under Acquisition) that Contains, and then enter the full spam site domain name. If you’re a bit more technical, you can use the Matches Regex option instead. To add more domains, just select Or and repeat the process.

Google Analytics Referral Spam Segment

Finally, save the segment and you’re done! Each time you come to analyse your data, apply the segment first (or remove it if necessary) from the Reporting dashboard and you’re good to go.

Hopefully you now have a better idea about what referral spam is and how to tackle it. Have your own ways of removing referral spam? Let us know in the comments or tweet @unwrittenteam!