Martech hub

Bots and Spam in Google Analytics: Problems & Solutions

Bots and Spam in Google Analytics: Problems & Solutions

Have you recently noticed some bot traffic or spam in Google Analytics?

No worries. You’re not alone.

Google Analytics is the business’s source of truth for making well-informed marketing decisions.

But for the tool to be reliable, you need to be able to trust that data.

Sadly, some people decided that it would be a good idea for them to send spam to your Google Analytics account to get your attention.

Poor business plan. Right?

Maybe, but it's obviously working for someone. Otherwise, people wouldn't keep doing it. So, now, let's look at what the real problem is with bots and spam in Google Analytics:

Section linkSpam in Google Analytics: The Problem

The core of the issue is that anyone can send data to your Google Analytics account. All they need to have is your tracking ID, which looks something like UA-XXXXXXXX-X.

So a spammer can easily generate random numbers and use some very easy JavaScript code to send you tens, hundreds, or even thousands of fake page views.

Which leads to the obvious question: what are they gaining?

That part is simple. Much like a kid pulling the hair of someone they like, they’re getting your attention.

How? Again… that’s simple: they generally set the referral domain to their domain.

And when you see a new referral sending you hundreds or thousands of visits in a day, what will you do?

That’s right. You’re going to see that site to see what’s going on.

And from there, I would assume some people will take the action they want you to take (buy a shady SEO course that they sell, see some ads that they make money from, and more).

But this problem isn’t just annoying for you. It’s actually painfully costly.

That’s because this kind of bot traffic pollutes your data, which means your typical conversion rate suddenly goes south.

All the data that’s been driving your marketing decisions, telling you what kind of content to produce, where your sales are coming from, and what pages are most engaging… all of that information gets skewed.

These kinds of spam-attacks were very popular in 2016 during the Trump election. That said, there have been spikes once in a while of various new spammers.

Here are some examples you may or may not have seen in your Google Analytics account:

  • lifehacĸĸ
  • B8ercomoriginalidnfakesafebeston_ff/,

When you see these names appear, you know you’re dealing with bot traffic and spam in your Google Analytics account.

That means it’s time to act fast. Fortunately, I have just the solution you’re looking for.

Section linkBots and Spam in Google Analytics: The Solution(s)

The solution will vary depending on the spammers. There are solutions that will block most of them, but not a single solution will fix all your problems.

That said, these strategies are easy to apply. You need to apply filters on your Google Analytics views.

For that, you first need to figure out what patterns the bots are using to flood your Google Analytics account.

First, though, let’s take a step back and make sure we’re all on the same page.

Section linkWhat Are Google Analytics Views?

Your Google Analytics account is separated into multiple levels. You can see them in the admin section as 3 columns:

3 columns in google analytics

The first level (and column) is the Account. Typically, that is the company name.

The second level is the Property. This should be your website, and it’s where the data is sent to.

The third and last level is the View. Once the data is sent to the property, it is processed by Google’s server and shown to you in the view. By default, it will be called “All Website Data”.

That process can be altered with filters based on your needs.

Section linkOk, but What Are Filters?

Filters are instructions that you can give to Google Analytics. They’ll be applied during the processing of your data before making it available in your view for you to see.

A filter can be applied to a specific view, but not all of them.

So, for example, you can create a filter to remove all the traffic coming from your office based on the IP address of your office.

As Google is processing the data, it will remove (or filter out) traffic coming from the IP address you set. This helps keep your data pure while you’re internally testing your site’s marketing funnels.

But filters are also our main weapon against spam.

Before diving into how, let’s get clear on how many Views you should have and where to apply filters to fight spam in Google Analytics.

Section linkVery Important Best Practice: Which Views Should I Create?

I would highly recommend having at least these 3 views:

  1. Raw: this one should never, ever have any filters.
  2. Test: this is where you will apply new filters first.
  3. Master: this is the view where you will consume data.

The first step I would recommend is to rename “All Website Data” to be your new “Master” view.

Then, create a “Raw” and a “Test” view. You can also copy the “Master” view to make sure they share the same configurations, like currency and time zone.

Make sure that the “Raw” view has no filter.

And make sure that the “Test” view has the same filters as the “Master” view.

Moving forward, when applying new filters, you’ll create and apply them to your “Test” view.

Now wait 2 days and see the differences in data for your Test and Master views for the full day they had a different set of filters.

Then ask yourself the following questions 2 questions:

  • Did it remove data you didn’t want to remove? That means there is something wrong and you need to tweak it.
  • Did it remove the data you wanted to remove but nothing else? Awesome! You can apply it to your Master view.

This is one of the reasons why having 3 views is so important in Google Analytics. It lets you test filters before applying it to your Master view.

That way, you can be sure not to mess up any of your valuable data while configuring and testing your filters (or conversion goals, for that matter)

Section linkHow to Identify Patterns for Bots in Google Analytics

To be able to properly remove spam, you need to identify their patterns so you can replicate that in filters.

In the past, they would often have fake hostnames. Nowadays, they are smarter, but they’re still not flawless.

Sometimes, they have no Browser Size set, they have a specific (fake) source of traffic, or they use an invalid language.

You need to identify what makes these bots different from your real traffic.

Section linkThe Filters & Settings to Exclude Bots and Spam

Below, you’ll see the main techniques I use and that I have used in the past while doing Google Analytics work for my clients.

Before even adding filters, there is a setting in your Google Analytics views to exclude some known bots.

You should tick that box for sure, at least on your Test and Master views:


With that out of the way, here are the main filters you should add.

Section linkFilter #1: Valid hostname(s)

This one has prevented the vast majority of the fake traffic in the last few years.

There are 2 ways to configure it. The easy way, if you only have a single domain, is to set it like this:


But if, like us, you have multiple domains, here’s what it should look like:


This looks a bit funky right? Those are regular expressions. Here is what the pattern looks like for us:


The vast majority of spammers don’t even try to use your real hostname, so this will easily block them.

Section linkFilter #2: Include Browser Size With an X (Should Exclude (Not Set))

This is the latest that appeared in late January to early February of 2021 and made massive spikes on a lot of sites’ data.

I am talking about all the“” and “” you might see in your pages or referrals.

Let’s be honest, this one is a bit annoying, as it has different patterns. See for yourself:


Some people tried to block it based on the Source, but that’s not enough because this particular bot sometimes fakes organic traffic.

But I found out, as you can see in the screenshot, that it doesn’t have a Browser Size set. That’s the only dimension I could find that has something weird.

The sad thing is that we can’t filter on empty values or “(not set)”. So, what does every other Browser Size value have in common?

The “x”.


So this filter will only include traffic with Browser Size that includes an “x”:


Depending on how committed they are to this spam, they might change the bot’s behavior. But this method worked as of February 4th, 2021.

Section linkFilter #3: Exclude Langage Spam

A technique that was very popular in 2016 was to send all sorts of fake things to the languages.

So instead of “en-us” or “fr-ca”, for example, you could see things like “Secret.ɢ You are invited! Enter only with this ticket URL. Copy it. Vote for Trump!”.

We then developed this filter to prevent invalid languages to be sent by spammers:

Example of configuration for language spam filter

Here is the pattern if you’d like to copy and paste this in your own Google Analytics account::


Section linkFilter #4: Exclude Bot Traffic With Language “c”

The last tip on our list is to prevent some traffic from bots. These typically aren’t spammers but more bots that crawl your site for various reasons (indexing content, finding emails, and so on):

filter out with language c

And the pattern to copy for this is:


Section linkFighting Spam in Google Analytics: Final Thoughts

If you found this last wave of spam bots annoying, then you’re in good company.

Scammers are always coming up with new ways to invade your website, get your attention, and monetize short-sighted marketing tactics.

But in the game of “cat and mouse,” the good news is that the cat usually wins. And when you’re working with a tool like Google, you can always find ways to come out ahead.

I hope you found this article helpful. If you did, you might want to check out the following resources:

These articles will have everything you need to get more accurate data from Google to optimize your marketing and sales effort.

Want to combine your Google Analytics data with KPIs from other marketing channels for a more comprehensive marketing report?

Click below to start your risk-free Metrics Watch trial (no credit card required):

Start Your Free Metrics Watch Trial Today!

Start sending automated reports today

Start your free trial, no credit card required!