How to Filter Out Google Analytics Spam
Seeing strange websites in your Google Analytics referral traffic like 'traffic-bot.xyz' or 'free-social-buttons.com'? If your data is getting cloudy with junk traffic, you've come to the right place. This guide will walk you through exactly how to identify and filter out Google Analytics spam, so you can trust your data and make decisions with confidence.
First, What Is Google Analytics Spam and Why Does It Matter?
Google Analytics spam is essentially fake traffic sent to your website's tracking ID. This junk data pollutes your reports, making it difficult to understand how real users are actually behaving on your site. When your analytics are skewed by spam, you might make poor marketing decisions based on faulty information.
There are two main types of spam you’ll encounter:
- Ghost Spam: This is the most common type. It’s called "ghost" spam because these bots never actually visit your website. Instead, they send fake "hits" directly to Google's measurement servers using your unique Analytics tracking ID (e.g., G-XXXXXXX). They find these IDs through scrapers or sometimes just by guessing them.
- Crawler Spam: These are actual bots that visit your site, crawling pages just like a search engine bot would. However, unlike legitimate bots (like Googlebot), these bots ignore rules that tell them not to be tracked and end up being recorded as user sessions in your analytics.
Both types of spam wreak havoc on your key metrics, often causing a strangely low average session duration, an unbelievably high bounce rate (usually 100%), and phantom traffic from locations you don’t target. Cleaning it up is essential for accurate reporting.
Part 1: How to Identify Spam Traffic in Your Reports
Before you can block spam, you need to find it. Here are the most common places to look in your GA4 property to spot suspicious activity.
Check Your Referral Traffic Report
The referral report is ground zero for identifying crawler spam. You’ll often find a list of sketchy-looking domains sending you traffic.
Here’s how to check:
- In your GA4 property, navigate to Reports → Acquisition → Traffic acquisition.
- In the report, change the primary dimension from 'Session default channel group' to Session source / medium.
- Add a filter at the top of the report: Click 'Add filter', select 'Session source / medium' as the dimension, and enter 'referral' in the value field. This will show you only referral traffic.
- Scan the list of sources. Look for anything that doesn’t look like a legitimate website.
Red flags include:
- Domains that are clearly trying to sell you something (e.g., get-more-traffic.com).
- Domains with names full of random characters.
- Domains that seem completely unrelated to your industry or audience.
- Service-based domains that people wouldn't typically click a link from (e.g., buttons-for-your-website.com).
Keep a list of these spammy domains - you’ll need it for the filtering process later.
Look for Suspicious Hostnames
Examining hostnames is the most reliable way to identify ghost spam. A hostname is simply the domain where your Google Analytics tracking code was fired. For most businesses, the only valid hostnames should be your own domain (e.g., mybusiness.com) and any related domains you own or use (e.g., checkout.shopify.com if you're on Shopify, or vimeo.com if you embed videos).
Ghost spam appears under hostnames that are not your own. Here’s how to find them using an Exploration:
- Navigate to Explore in the left-hand menu and create a new 'Blank exploration'.
- In the 'Variables' column on the left, click the '+' sign next to 'Dimensions'. Search for and import Hostname.
- Click the '+' sign next to 'Metrics'. Search for and import Sessions and Active users.
- Drag Hostname from the Variables column to the 'Rows' section in the main panel.
- Drag Sessions from the Variables column to the 'Values' section.
You'll now see a list of every hostname that has sent data to your GA4 property. Make a list of all the legitimate ones. Any hostname that you don’t recognize, or those that look like blatant spam, is the ghost spam you need to filter out. Seeing a (not set) hostname is another classic sign of spam.
Analyze Behavior Metrics for Obvious Outliers
Spam traffic often behaves in an unnatural way. A quick look at your engagement metrics can help you spot it.
- Bounce Rate (or low Engaged sessions): GA4 has replaced bounce rate with 'Engagement rate'. Spam almost always results in a 0% engagement rate on those sessions.
- Average Engagement Time: Spam sessions typically last for 0-1 seconds.
In your Traffic acquisition report, add a secondary dimension of 'Hostname'. Now you can see the behavior metrics broken down by hostname. If you see a hostname with a 100% bounce rate (or near 0% engagement rate) and an average session duration of almost zero, it’s highly likely spam traffic.
Part 2: How to Filter Spam Out of Google Analytics 4
Now that you've identified the junk, it's time to get it out of your reports. GA4 filters data as it comes in, meaning these changes will only apply to future data. (We'll cover how to clean historical data later).
Step 1: Activate Google's Default Bot Filtering
Google maintains its own list of known spiders and bots. GA4 can automatically filter this traffic out for you. In Universal Analytics, this was a manual setting, but in GA4, it's typically enabled by default. It's always a good idea to confirm it's active.
- Go to Admin (the gear icon in the bottom-left).
- Under the 'Property' column, click on Data Streams and select your web stream.
- Click on Configure tag settings at the bottom.
- Under the 'Settings' section, click Show all.
- Select Define internal traffic. The section that manages bot traffic isn't here anymore. GA4 has integrated it more deeply.
- Now go back to Admin → Data Settings → Data Filters.
You should see a filter named 'Internal Traffic' and possibly an active filter for bot traffic. As of recent GA4 updates, bot filtering is handled automatically with no toggle, but keeping an eye on your Data Filters section is a good habit.
Step 2: Create a Referral Exclusion List for Crawler Spam
Remember that list of spammy referral domains you made? Now you can tell GA4 to ignore any traffic coming from them.
- Go to Admin → Data Streams and click on your website's data stream.
- Click Configure tag settings below the stream details.
- Under 'Settings', click on Show all, then click List unwanted referrals.
- Under 'Match type', select Referral domain contains.
- In the 'Domain' field, enter one of the spammy domains you found (e.g., traffic-bot.xyz).
- Click Add condition to add more rows and continue adding all the spam domains from your list.
- Click Save when you're done.
From this point forward, GA4 will ignore any sessions originating from these domains.
Step 3: Filter by Your Hostname to Block Ghost Spam
This is the single most effective way to eliminate ghost spam for good. You'll create a data filter that tells GA4 to only include data from your legitimate hostnames.
Warning: Be very careful with this filter. If you configure it incorrectly, you could accidentally block all of your real traffic. Double-check your list of valid hostnames before proceeding.
- Go to Admin → Data Settings → Data Filters.
- Click the 'Create Filter' button in the top right.
- Choose the 'Include only' filter type.
- Give your filter a descriptive name, like "Include only traffic from valid hostnames".
- Set the 'Filter field' to Hostname.
- Set the 'Filter value' using a regular expression that lists all your valid hostnames, separated by a pipe
|.
Your regex will look something like this:
yourdomain\.com|seconddomain\.net|shopify\.comImportant notes on the regex:
- The pipe symbol
|means "OR". - You must "escape" any periods in domain names with a backslash
\because a period is a special character in regex. So,yourdomain.combecomesyourdomain\.com.
Enter your customized regex in the 'Filter value' box. Change the 'Filter state' from 'Testing' to Active once you are certain it's correct, and then click 'Save'. This filter tells GA4 to discard any hit that doesn't come from one of the domains you listed.
Bonus: Cleaning Spam from Your Historical Data
The filters above only work on data collected from now on. To analyze past data without spam, you need to use "Comparisons" in your standard reports (GA4's version of segments).
- Go to any standard report, like Reports → Acquisition → Traffic acquisition.
- At the top of the report, click Add comparison.
- In the builder on the right, create a condition.
- Set the Dimension to 'Hostname'.
- Set the Match Type to 'matches regex'.
- Enter the regex from the previous step.
- Create a condition to Include valid hostnames using:
yourdomain\.com|shopify\.com. - Click Apply.
You can now compare your spam-free data against the original, unfiltered data. To view only the clean data, simply remove the "All Users" comparison by clicking the 'x' on its card.
Final Thoughts
Keeping your Google Analytics data clean from spam is not a one-time fix but an ongoing process. By regularly checking your referral and hostname reports and applying the right filters, you can ensure your analytics are accurate, enabling you to make smarter, data-driven decisions for your business.
We know tedious reporting tasks are the last thing you want to spend time on - even with perfectly clean data. Manually building dashboards in Google Analytics or exporting data to a spreadsheet takes hours you could be using for strategy. That's why we built Graphed. After connecting Google Analytics in a few clicks, you can ask for whatever report you need in simple language, like "show me my top converting landing pages by traffic source" and instantly get a live, sharable dashboard that stays up-to-date automatically.
Related Articles
What SEO Tools Work with Google Analytics?
Discover which SEO tools integrate seamlessly with Google Analytics to provide a comprehensive view of your site's performance. Optimize your SEO strategy now!
Looker Studio vs Metabase: Which BI Tool Actually Fits Your Team?
Looker Studio and Metabase both help you turn raw data into dashboards, but they take completely different approaches. This guide breaks down where each tool fits, what they are good at, and which one matches your actual workflow.
How to Create a Photo Album in Meta Business Suite
How to create a photo album in Meta Business Suite — step-by-step guide to organizing Facebook and Instagram photos into albums for your business page.