Referral spam in Google Analytics


9 mins

Referral Spam in Google Analytics

Table of Contents

Clicks and visits from referral sites are a valuable metric for any business to track. After all, if people are talking about your site on other platforms, it’s a good sign that you’re doing something right.

However, what if those clicks and visits are coming from a malicious source?

This is the case with referral spam, which can pollute your Google Analytics data and give you a false sense of how well your site is performing.

Marketers who don’t know about referral spam, how to filter it, and how to clean it from their data risk making major marketing decisions based on fake bot traffic. 

It can also leave you and your clients vulnerable to security threats like malware, an overloaded server, or data theft.

In this guide, we’ll show you everything you need to know about referral spam in Google Analytics. This includes identifying, filtering, and blocking referral spam from your analytics. We’ll also discuss how to fix referral spam from your historical data to avoid compromising the integrity of your data.

What is referral spam in Google Analytics?

Referral traffic is defined by Google Analytics as traffic that comes to your site from another site. This includes, but is not limited to, links from social media platforms, blogs, and other websites.

On that note, referral spam (also known as referrer traffic or log spam) is fake traffic or hits that originate from bot programs. These bots are designed to spoof web browsers and make it appear as if they are referring traffic to your website.

There are two main sources of referral spam traffic. Here are they:

  • Spammy web crawlers: These are programs that visit your site and generate fake traffic by simulating clicks and visits.
  • Ghost referrals: These bots never actually visit your site. Instead, they target Google Analytics directly by sending fake data to your Google Analytics tracking code.

No matter the source, referral spam in GA can have a significant impact on your website traffic data:

  • For example, if a ghost referral is sending 100 pageviews to your site every day, that’s going to inflate your traffic numbers significantly. This can lead you to make misguided marketing decisions, like increasing your ad spend when there’s no real increase in traffic.
  • Referral spam can also have a negative impact on your website’s performance. For example, if a spammy web crawler is visiting your site too frequently, it can overload your server and cause your site to crash.
  • What’s more, referral spam is a security risk. Some referrer bots are designed to harvest email addresses or personal information. Others may install malware on your computer if you click on a malicious link.

Black hat marketers, or marketers who use unsavory tactics to game the system, use referral spam for various reasons. Here are some of them:

  • To sell products or services: Many referrer bots will include links to shady products or services in their fake traffic. When you click on the link, something called “cookie stuffing” happens. This is where the referrer bot drops a cookie on your computer that tracks your clicks and purchases. The marketer can then use this information to target you with ads.
  • To commit PPC ad fraud: Seeing tons of pageviews from a domain can easily tempt you into clicking the link to see what’s going on. Once you do, the spammers get paid for every click they generate.
  • To artificially boost their SEO rankings: The more clicks and traffic a site gets, the better its SEO will be. So by artificially inflating their traffic numbers (when marketers click on their spam referrer link), spammers can improve their SEO rankings and get more organic traffic.
  • To harvest contact information: Most websites are a goldmine of email addresses, phone numbers, and other contact information. Clicking on spam referral URLs designed to phish for information can lead to your website’s contact database being stolen and sold to third-party marketers.

Now, while bots trigger referral spam, not all bots are bad. Some are incredibly useful – Google itself uses bots to crawl websites and index them in search results, for example.

Other bots can help you check the health of your website, convert web content into mobile formats, and more.

Unfortunately, bad bots simply outnumber good bots. In 2022, 27.7% of all internet traffic comes from bad bots. Given that only 62% of web traffic comes from humans, that’s a massive chunk.

The harsh truth is that it’s impossible to avoid referral spam in Google Analytics. Even the most well-protected website will eventually fall victim to it.

However, that doesn’t mean you’re powerless against it. There are a few things you can do to protect your GA data and prevent referral spam from undermining your marketing strategies.

The first step is learning how to identify spam referral traffic in your analytics data.

How to identify referral spam in Google Analytics

Today’s bots are more sophisticated than ever. Some can eerily mimic human behavior only, such as filling out forms and leaving comments. Others are much more basic, only triggering page views.

That said, there are still a few telltale signs that you’re dealing with referral spam. Here are some of them:

1. Abnormally high or low traffic levels

If you see a sudden spike or drop in traffic that doesn’t match up with any changes in your marketing campaigns, it’s likely that you’re dealing with referral spam.

2. Unusual referring domains

Spammers will often use fake or made-up referring domains (e.g., ““). If you see a referring domain that you don’t recognize, it’s worth investigating further.

3. Keywords that don't make sense

Referral spam can also contaminate your keyword data. For example, if you see a keyword that doesn’t match up with any of your content or campaigns, it’s likely spam.

4. 100% bounce rate

If all of your traffic is coming from referral spam, you’ll often see a 100% bounce rate in GA. That’s because bots don’t stick around to browse your site as real humans would.

5. 0% conversion rate

Spammers are only interested in getting you to click on their links. They’re not interested in actually doing business with you. As a result, referral spam almost always has a 0% conversion rate.

If you see any of these signs in your GA data, there’s a good chance that you’re dealing with referral spam.

The specific steps you’ll need to take to get rid of referral spam will also vary depending on which analytics platform you’re using.

For Universal Analytics, follow these steps to help you pinpoint spam referrals:

  1. To get started, log in to the Admin section of your Universal Analytics account.
  2. Go to “Acquisition,” click on “All Traffic,” then go to “Referrals.”
  3. Next, under Referrals, you’ll see a list of all the websites that have sent referral traffic to your site.
  4. After that, click on the “Bounce Rate” column and re-order the list to show 100% bounces first.
  5. Then, scan the referral source URLs to see if any of them look suspicious.

Here’s a more comprehensive referrer spam list from GitHub, but some examples are:


If you’ve already migrated to Google Analytics 4 (GA), follow these steps below to identify referral spam:

  1. First, log in to your GA4 account.
  2. Next, click on “Reports” in the left sidebar and then go to “Acquisition.”
  3. Under Acquisition, scroll down until you see the traffic sources table.
  4. Next, narrow your search by typing “referral” into the search bar. Then, add “Session Source” as a secondary dimension.
  5. After that, re-order the results by clicking on the “Engaged Sessions” column. This will show you which referral sources had 0 engaged sessions.
  6. Finally, scan the results to spot referral spam URLs.

How to remove referrer spam in Google Analytics

After isolating the traffic data in your analytics data, the next phase is to remove referral spam.

One way is by using the .htaccess file to block referral spam URLs or domains. It’s rigorous but incredibly effective.

Blocking referral spam domains via .htaccess file doesn’t just prevent them from showing up on your website. Instead, it completely wipes them out from your server – lightening the load and preventing your site from slowing down.

Still, it’s a highly technical process that involves coding, server changes, directory configurations, and other complex steps. So, if you’re not comfortable with making these changes yourself, it’s best to hire a developer or ask your hosting company for help.

You can also use the built-in tools in Google Analytics to filter out referral spam. The process is different between Universal Analytics and Google Analytics 4, so let’s take a look at each one.

How to filter referral spam in Universal Analytics

To be able to filter referral spam in UA, simply follow these steps below:

  • First, log in to your GA account and go to the Admin section.
  • In the “Account” column, click on “All Filters.”
  • Next, click on the “Add Filter” button.
  • Then, select “Custom” for the filter type.
  • Choose “Exclude” for the filter field.
  • Select “Referral” from the drop-down menu.
  • After that, go to the filter pattern box and input all of the spam referral URLs you’ve identified in your analytics data.
  • Use the pipe (|) symbol to separate and enter multiple domains.

Note that filtering spam domains or URLs in this manner does not prevent referral spam. Instead, it simply hides them from your analytics data, therefore preventing them from contaminating your GA metrics.

How to block spam in Google Analytics 4

On the other hand, GA4 offers a stronger defense against referral spam. Unlike UA, which only filters the polluted data, you can actually define and block referral spam traffic before it reaches your website using the new tools in GA4.

Specifically, you’ll be directly blocking unwanted referrals by defining them. Here’s how you do it:

  • To get started, log in to your GA4 admin account.

Next, head to the Property column and click on “Data Streams.”

  • After that, click on “Web.” Then, select a web data stream. This will pull up the details of the web stream.
  • At the bottom of the web stream details, click on “Configure tag settings.”
  • Next, go to “Settings.” Then, click on “Show all” to see all available settings.
  • Finally, select “List unwanted referrals.”

At this point, you’re not just going to type in the URLs and domains of referral spam so that GA filters them out. Instead, you’re going to use conditions to target them before they even reach your analytics.

You can do this by defining the conditions under which a referral will be considered spam. Here’s what you can do:

  • Under “Include referrals that match ANY of the following conditions,” click on “Add condition.”
  • Upon clicking, a new window will pop up. Here, you can choose the match type. Choose “Domain.”
  • Under “Domain,” simply enter the identifier for the domain you want to block.
  • You can also add another condition by clicking on “Add condition” again.

Once you’re done, click on “Save.”

In GA 4, conditions are evaluated using the OR logic. This means that the traffic will be blocked if any of the conditions you set are met.

How to clean up historical data in GA using custom segments

In Google Analytics, historical data refers to data that was collected before you implemented referral spam blocking measures. This data is still stored in your GA account and can threaten the integrity of your analytics and reports.

The good news is that you can clean up historical data in GA using custom segments. This process is similar to the UA filtering technique we described earlier.

To create a custom segment in UA, follow these steps below:

  • First, log in to your GA account.
  • Then, navigate to the “Reporting” tab.
  • Click on “+ Add Segment” in the top left corner of the screen.
  • Next, click on “Create new segment.”
  • Label your segment something relevant, such as “Exclude Spam Referrals.”
  • After that, click on the “Traffic Sources” filter.
  • Finally, set the “Filter Sessions” to “Source” and set this to “not match” the referral source domains.

Custom segments are a powerful tool in GA. Not only can you use them to clean up historical data, but you can also use them to segment your data in various ways. This way, you can get a more accurate picture of your website’s traffic and performance. But in the case of referral spam, custom segments can help you take care of business and keep your data clean.

Wrapping it up

Referral spam is a problem that’s not going away anytime soon. But with the right tools and techniques, you can defend your website against these pesky spammers. First, learn how to identify referral spam – look for red flags like unexpected spikes in traffic, fake social media referrals, and odd referral sources.

Once you’ve identified referral spam, use GA tools to stop them in their tracks. For instance, use filters and custom segments in UA to remove referral spam from your data. And in GA 4, use the new tools like custom dimensions and conditions to block referral spam before it reaches your account.

The cleaner your data is, the smarter marketing decisions you can make for yourself and your clients.

Use Reporting Ninja’s Google Analytics integration to automate your GA Reporting and make your data work for you! Our software will help you quickly identify referral spam, as well as other issues that could be skewing your data. It also takes a few clicks to create beautiful, intuitive Google Analytics reports so you can focus on insights, not data entry.

Try Reporting Ninja free for 14 days – sign up here to grab your free trial today!

Reporting Ninja
Post written by