How to Block Referral Traffic in Google Analytics

Cody Schneider8 min read

Seeing suspicious-looking website names in your Google Analytics referral traffic report can be more than just annoying - it can seriously skew your data. Referral spam clutters your reports, making it difficult to understand what’s actually driving performance. This article will show you how to identify that bad traffic and then provide step-by-step instructions for blocking it in both Google Analytics 4 and older Universal Analytics (UA) properties.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

What is Referral Traffic in Google Analytics?

First, let’s quickly cover the basics. Referral traffic is recorded whenever a user clicks on a link from another website to get to yours. For example, if a blogger writes a great article about your business and links to your site, anyone who clicks that link will show up in your reports as referral traffic from that blog. This is the good stuff - it helps you understand which websites are sending you interested visitors.

Referral spam, on the other hand, is completely different. It's fake traffic generated by bots designed to clutter up your analytics reports. The goal is often to get website owners like you to visit the spammy URL out of curiosity, hoping to sell you something or trick you with a phishing scheme. It provides zero value and pollutes the data you rely on to make important decisions.

This unwanted traffic generally falls into two categories:

  • Ghost Spam: This spam never actually visits your site. It uses a loophole in the Google Analytics Measurement Protocol to send fake data directly to Google's servers, making it appear as if someone visited your pages from another website. It’s the most common type of referral spam.
  • Crawler Spam: These are bots that do visit your website, but they ignore the rules most well-behaved bots follow. They crawl your pages for different reasons (often malicious), and their visits get recorded as sessions in your analytics, artificially inflating your traffic numbers.

Ignoring this mess can lead you to draw the wrong conclusions about your marketing campaigns, misread your user behavior, and waste time analyzing junk data.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

How to Spot Unwanted Referral Traffic

Before you can block spam, you have to find it. Thankfully, spammy referrals often leave obvious footprints. Navigate to your referral traffic report and look for sources with these telltale signs:

  • An extremely high bounce rate (often 100% or very close to it).
  • An extremely low average session duration (usually 00:00:00 or 00:00:01).
  • A suspicious or nonsensical domain name, sometimes including keywords like "free," "money," "buttons," etc.

Basically, if a referral source sent you a hundred visitors who all left instantly without doing anything, it’s almost certainly spam. A quick Google search for the suspicious domain name will also often reveal other webmasters complaining about it.

Finding Your Referral Report

Here’s where to look in both versions of Google Analytics:

In Google Analytics 4

  1. Navigate to Reports > Acquisition > Traffic acquisition.
  2. The default report groups traffic by ‘Session default channel grouping’. Click the drop-down and change it to Session source / medium.
  3. You can add a filter to see only referral traffic. Click Add filter + at the top of the report, set the dimension to ‘Session source / medium’, the match type to ‘contains’, and enter the value referral.

Pro Tip: To quickly scan for suspicious domains, add 'Hostname' as a secondary dimension to your traffic report. If you see traffic recorded on hostnames that aren’t your actual website, it's a huge red flag for ghost spam.

In Universal Analytics (UA)

  1. Navigate to Acquisition > All Traffic > Referrals.
  2. The list of referral domains is displayed right there. Scan it for anything that looks out of place based on the spam indicators mentioned above.

Blocking Unwanted Referrals in Google Analytics 4

Google Analytics 4 handles referral exclusion differently than its predecessor. You can no longer create View Filters. Instead, GA4 introduced a feature called "List unwanted referrals" within your Data Stream settings. This process doesn't completely block the traffic from being recorded, but it re-classifies it as (direct) traffic, effectively cleaning it out of your marketing and referral reports.

This is a forward-looking fix, it won't clean up your historical data. Here’s how to set it up.

1. Navigate to Your Admin Settings

Click the gear icon for Admin in the bottom-left corner of your GA4 dashboard. In the 'Property' column, click on Data Streams.

2. Select Your Web Data Stream

Click on the data stream connected to your website. This is typically the one with your site’s name or URL.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

3. Configure Tag Settings

Scroll down to the 'Additional Settings' section and click on Configure tag settings.

4. Define Unwanted Referrals

In the Settings screen, you might need to click Show more to see all options. Find and click on List unwanted referrals.

5. Add Your Spam Domains

This is where you'll build your exclusion list. Under 'Match type', select Referral domain contains. In the 'Domain' field, enter the spammy domain you want to exclude (e.g., spam-bot-site.com). You can add multiple domains, one per condition line. When you're done, click the blue Save button at the top right.

From this point forward, visits originating from these domains will no longer be labeled as referral traffic in your reports.

For Posterity: Blocking Referrals in Universal Analytics (UA/GA3)

If you're still working with Universal Analytics data, the process involves creating a custom filter in your View settings. A word of caution: filters are destructive and permanent. Once data is excluded, it's gone for good. That's why the number one rule is to never apply new filters to your primary, unfiltered view. Always create a new, filtered view or apply it to a test view first.

1. Create a New, Filtered View (Absolute Best Practice)

Go to Admin and in the 'View' column, click the dropdown menu and select Create View. Name it something clear like "Master View - Filtered" or "Website Data - Clean."

2. Go to Admin and Select Your Test/Filtered View

Make sure you've selected your newly created (or existing filtered) view from the top of the View column. Then, click on Filters.

3. Create a New Filter

Click the red + ADD FILTER button. Name your filter something descriptive like "Referral Spam Exclusion."

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

4. Configure the Filter Settings

Use the following configuration:

  • Filter Type: Custom
  • Select the Exclude radio button.
  • Filter Field: Campaign Source
  • Filter Pattern: Enter the list of spam domains you want to block. You need to separate each domain with a pipe character (|), which acts as an "OR" operator in regular expressions. Don't add spaces between them.

Your filter pattern would look something like this:

spam-domain1.com|evil-seo-bot.net|another-spam-website.org

After you paste your list of spam domains, click Save.

Additional Tips for Clean Analytics Data

Excluding referrals in Google Analytics is a great way to handle ghost spam, but for crawler spam, you may need a more robust solution.

  • Use GA's Bot Filtering Option: Both UA and GA4 have a feature to exclude traffic from known bots and spiders. In UA, it's a checkbox in Admin > View Settings > Bot Filtering. In GA4, this is automatically enabled within your Data Stream and you do not need to take any action. While this helps, it is not a catch-all solution.
  • Use Segments for Historical Analysis: Filters don’t work retroactively. If you need to analyze historical data without the spam, create a Custom Segment. You can set the segment conditions to exclude sessions where the 'Source / Medium' contains the spam domains you’ve identified. This lets you see what your data would have looked like without the fake traffic.
  • Block Bots at the Server Level: For the most stubborn crawler bots, a great permanent solution is to block them from even accessing your server. You can do this by modifying your website’s .htaccess file. This is a more technical solution, but it's the most effective way to block bad crawlers. A basic rule could look like this (but be very careful editing this file!):
# Block Spam Referral Domains
RewriteEngine on
RewriteCond %{HTTP_REFERER} bad-referrer\.com [NC,OR]
RewriteCond %{HTTP_REFERER} another-spammer\.com [NC]
RewriteRule .* - [F]

Final Thoughts

Keeping your Google Analytics data clean by regularly identifying and blocking referral spam is a critical maintenance task. It ensures the data you depend on is accurate, making your reports more trustworthy and your strategic decisions more effective. The process is different between GA4 and Universal Analytics, but the result is the same: clearer insight into your real audience.

Manually wrangling configurations across different analytics platforms can feel like a full-time job. To unify your crucial marketing and sales data without the headache, we created Graphed. It allows you to connect directly to all your key sources - like Google Analytics, Google Ads, or HubSpot - and simply ask for the reports you need in plain English. Instead of building filters, you can chat with your data and ask things like, “Show me last month's top 10 referring websites, not including traffic from xyz-spam.com,” and get an interactive, real-time dashboard in seconds.

Related Articles

How to Enable Data Analysis in Excel

Enable Excel's hidden data analysis tools with our step-by-step guide. Uncover trends, make forecasts, and turn raw numbers into actionable insights today!