Referral spam in Google Analytics

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.
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:
No matter the source, referral spam in GA can have a significant impact on your website traffic data:
Black hat marketers, or marketers who use unsavory tactics to game the system, use referral spam for various reasons. Here are some of them:
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.
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:
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.
Spammers will often use fake or made-up referring domains (e.g., "best-seo-solution.com"). If you see a referring domain that you don't recognize, it's worth investigating further.
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.
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.
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:
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:
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.
To be able to filter referral spam in UA, simply follow these steps below:
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.
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:
Next, head to the Property column and click on "Data Streams."
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:
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.
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:
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.
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 to grab your free trial today!
Sign up for a 15 days free trial. No credit card required.