It annoyed me. So I figured out how to get it off my dashboard, and here’s how.

At my company we keep a close eye on our Google Analytics web stats, probably like you. Yesterday, we popped into our real-time stats and noticed a bunch of sessions from around the world. Hey wow, that’s pretty cool!

There were 38 concurrent sessions. That’s not an abnormal level (Phrasee is a niche product, so we don’t want or expect millions of sessions), but the geographic spread was interesting. Who knew we were so huge in Southeast Asia?

So I looked into it a bit… and guess what:

Ugh. That’s so annoying.

What is Google Analytics referral spam?

Referral spam has been a trend for the last year or two. Some dodgy spammers refer fake traffic to your site, always from silly looking URLs like these…

(note: don’t actually go to these sites.)

Our site gets thousands of these garbage referrals every month. It reminds me of the “Ch33p V14gr4” email spam that was prevalent in the early 2000s. Slight misspellings of something that’s marginally interesting.

Why do these nefarious spammers create referral spam?

I’ve got a few theories, but there are likely other reasons. Anyways, here are my thoughts:

  1. These spammers want you to back-link to them, and figure less-aware webmasters will ping back to their sites.
  2. Some of the referring sites have malware on them, so they’re hoping you’ll see them in your stats, visit the sites to investigate… and get infected.
  3. These spammers have singled me out and want to mess up my web stats, because I got to the bar about three seconds after them and got served first, which annoyed them, so they’ve gone out of their way to make my life difficult.

Likely #s 1 & 2 are the culprits. #3 likely didn’t happen. I always note the time-sequence of arrival and stand by the unwritten rule of bar service. Because a civilisation without rules isn’t a civilisation at all. It’s anarchy. And I don’t want to contribute to that form of anarchy.

Why should you care about referral spam?

Referral spam isn’t going to mess up how your site functions (as far as I can tell), so from that standpoint it’s no biggie.

What it will do is screw up your data-driven decision making!

Why? Because if a huge amount of traffic comes from spurious sources, and you don’t remove it from your KPI metrics, then your web statistics will be untrustworthy and skewed.

Say 10% of your traffic is referral spam, and the bounce rate for it is 98%. This brings up your overall bounce rate to, say, 60% from 52%.

So based upon that bounce rate jump, you’d initially think you’ve got a user experience problem, and spend loads of time trying to fix it. But there’s not actually a problem – referral spam is messing up your decision making. See what I mean?

So how do you get rid of referral spam in Google Analytics?

Here’s the bad news: stopping it is virtually impossible. It’s going to keep happening, and I’m sure that the smart brains at Google Alphabet are trying to figure out a solution.

One caveat to mention:

I’m not a Google Analytics expert like many other people out there are. I’m a pragmatist, and I wear many hats on a daily basis, one of which is periodically looking at our web stats. So what I wanted to figure out was a simple, effective solution. It’s entirely possible (even probable) there’s other methods to fix this problem. This is just me sharing how I figured how to do something about it.

If you’ve got a better method then by all means share it in the comments! I’d love to know if I could be doing it better myself.

Option 1: Block IPs server-side (pain in the butt)

What you could do is identify the source IP addresses of the referral spam and block them from accessing your site.

I tried this for a bit, but found that these dastardly spammers kept moving IP addresses! Plus, making server-level adjustments requires mucking about in Apache or something like it (the WordPress plugin I tried mega messed up our .htaccess file, so I just did it old-school in a console.)

Also, most marketers wouldn’t have the access or skill set to do this, so they would refer it to their IT team… and delays would ensue…

Plus, and importantly, you run the risk of blocking legitimate traffic. These spammers could be using a phished botnet to serve the referral traffic. So by blocking IPs you could be stopping potential readers from accessing your site. I don’t know if this was the case or not, but I didn’t want to risk it.

Option 2: Use Google Analytics filtering (less of a pain in the butt)

This is the best solution I found, but it requires a small bit of work on a weekly basis. It takes me about 5-10 minutes each Monday to sort it out.

Follow these steps:

  1. Look at your referral traffic, and identify anything that looks a bit dodgy.
  1. Click ‘Add segment’ at the top of your screen and click ‘New Segment’, then click Advanced -> Conditions.
  1. Add a filter for ‘Source’ ==> ‘Contains’. It’s easier to use ‘Contains’ as you’ll quite often find patterns in the referral spam URLs. This saves you a bit of time and may prevent similarly structured URLs in the future. I also experimented with regular expressions, but the pattern matching was removing some legitimate traffic sources so I don’t think it’s a durable solution.
  1. Click save. (I forgot to save it the first time, so had to do it twice. I’m smart.)

Now the stats you see in your GA dashboard will be your actual traffic, not these ropey spammer stats. It’ll help you avoid making decisions based upon bad statistics.

It’s not hard to segment out referral spam, and it’s important

Referral spam is a pain in the butt, and I still don’t quite get why these annoying dudes bother doing it. There’s way better ways to annoy people online. For example:

  1. Posting pictures of your dinner on Instagram. Hey! You ate dinner! Well done, I’m happy for your digestive system.
  2. Posting pictures of your kids on Facebook. Hey! You have kids! Well done, I’m happy that your reproductive system is functional.
  3. Posting motivational quotes on Twitter. Hey! You’ve figured out how to copy and paste! Well done, I’m happy that you know how to plagiarise.


If there are other, better methods to remove referral spam in GA, I’m all ears

This is the way that I figured out to do it, being a non-GA specialist… and it seems to work for now. To be honest, I was annoyed by these dodgy stats, and reckon at least one other person out there is probably annoyed too… so I hope this blog post will help you become less annoyed!

Take that, you spurious spammers! Digital marketers: as you were.