How To Remove Referral Spam In Google Analytics

Last Edited September 11, 2023 by Garenne Bigby in Search Engine Optimization

remove referral spam google analytics

Has there ever been a time that you are looking at your Google Analytics, and noticed a strange influx of referral traffic to your site? You haven't run a special promotion or released a particularly outstanding piece of content and suddenly gone viral. You are not entirely sure what is happening and why. In order to get the correct data that reflects your analytics accurately, you will need to get rid of the referral spam for good. How should you deal with this surprise influx and unwanted spam? Read on carefully to fix the problem.

What is Referral Spam?

It is possible that this is because of referral spam messing with the referral traffic information in Google Analytics. This happens when a website gets referral traffic that is not human-based, but is from spam bots or programs. This information is then recorded in the Google Analytics account, messing with the data and creating issues with reporting. Referral spam comes from all over the world and is sometimes easy to spot. Other times, it can be a bit more covert, but you should be looking for referral traffic with a bounce rate of 100%, or none at all—chances are that this is a spam website.

If you're still not sure, just visit the site for yourself and you'll discover if it is bringing real traffic or not. If you choose this route, be prepared with a good anti malware program installed. The technique behind referral spam is that there are repeated web site requests using a rake referral URL to the website that the spammer is aiming to advertise. Ghost spam is when the spammer has never even visited the website afflicted, and this is what those fake visits are called.

Fixing Referral Spam

There has been much talk about excluding referral spam, and not all of the information has been absolutely right. It is vital that you are not using the Referral Exclusion List on Google Analytics.

referral exclusion list

This is because it is used to exclude traffic from a 3rd party shopping cart to hinder customers from being counted in a new session also as a referral when they come back to the verification page after checking out of the 3rd party site. This can be a bit confusing, and it may be assumed that Google would keep the visit from the Analytics page. What really happens is that GA attempts to connect the returning visit to the prior source and medium, preventing it from being acknowledged as referral traffic. When there is no previous medium/source, it is not seen as direct traffic. In short, it will move one batch of bad referral traffic to a different medium/source, so the data is still being skewed in Analytics.

Remove Spam the Right Way

Now knowing that the referral exclusion list option is not the best option for fixing referral spam, what should be done? The traffic from each view has to be filtered off but not excluded while using the referral exclusion option at the level of the property.

How is this done? Do the following:

  1. Create a new filter called “Referrer Spam” at the view level
  2. Set it to “custom” type
  3. The field should be set to “campaign source”
  4. Within the pattern field filter, enter the referral spam domain
  5. Make sure that you save it

referral filter

This ensures that the spam traffic is filtered from those specific sources. When more sources need to be added, simply place a pipe after the domain, and escape the dot with a backslash.

This not becomes a regular expression for spam websites that need to be removed from Analytics. It is suggested to have a copy of this on hand in a text file for later use. Best practice always includes having a web developer check the regular expression and make sure that you check the “filter known bots and spiders” option.

These filters will only work from the time that they are created and take a full 24 hours to take effect.

Create a Custom Segment

A custom segment will remove spam data from GA reports and is a bit temperamental, so here are the general guidelines for doing so:

  1. Within Google analytics, open your reporting view and click on Add Segment, when select New Segment. This new segment should be called No Spam or something to that effect. Then, select Advanced Conditions on the left side.
  2. Select “sessions” and “exclude” in the filter options.
  3. “Matches regex” and “source” should be selected in the two drop down menus.
  4. Paste in the regular expression that was created previously. This is why you should have saved the expression previously.

After this, you will just save and then apply the segment. The applied segment will begin removing the ghost spam from the reports, leaving your Google Analytics with clean data.

It is important that you are checking your referral traffic on a regular basis, so that you can successfully identify and get rid of any ghost spam that could be making a negative impact on your reports in Google Analytics. The likely scenario is that when you have gotten rid of one spam website, hundreds or thousands more have been created, and the basic data cleansing in Google Analytics will not hold up for long. Whether you are choosing to take the technical route or the non-technical route, it is possible to get rid of referral spam from your Google Analytics data.

When referral spam is not taken care of, it presents a skewed version of your analytics, giving you a false report. As a brand, you need to have an accurate representation of your data and what is bringing traffic to the site. When you have skewed analytics, you cannot depend on those numbers to indicate what is and what is not working for your website. In just a few simple steps you can make sure that the referral spam is not harming your analytics.

Garenne Bigby
Author: Garenne BigbyWebsite:
Founder of DYNO Mapper and Former Advisory Committee Representative at the W3C.


Related Articles

Create Visual Sitemaps

Create, edit, customize, and share visual sitemaps integrated with Google Analytics for easy discovery, planning, and collaboration.


Popular Tags

Search Engine Optimization SEO Accessibility Testing Create Sitemaps Sitemaps UX User Experience Sitemap Generator Content Audit Visual Sitemap Generator
Create Interactive Visual Sitemaps

Discovery has never been easier.

Sign up today!