Kissmetrics Blog

A blog about analytics, marketing and testing

Kissmetrics Customer Analytics: See how each visitor behaves and make better decisions that drive growth

The Ultimate Guide to Removing Google Analytics Referral Spam

Some of the content from this post was inspired by the article “Definitive Guide to Removing Google Analytics Spam” by Mike Sullivan.

It started out simple enough with semalt and buttons-for-websites. Then the ilovevitaly attacks began. Pretty soon Ranksonic began mocking us with fake events and organic search terms. Before we knew it there was a full-frontal assault of fake referral spam masquerading as legitimate website visitors compromising the accuracy of our Google Analytics reports. We all knew Google was working on it, a definitive solution just never came.

The problem was, and still is, most marketers don’t know what referral spam is, how to spot it, or how to remove it. This presents a major problem when businesses and marketers begin using these inaccurate Google Analytics reports to make conversion rate optimization decisions on A/B tests, landing page optimization, and more.

Worse yet, many marketers are unknowingly presenting traffic numbers to bosses and stakeholders that could be off by up to 60%!

Thankfully, there are a few proven strategies to eliminate Google Analytics referral spam. In this article we’ll discuss what referral spam is, how to identify it in your reports, and I’ll show you a few tried and true methods to clean up historical reports and prevent referral spam from effecting reports in the future.

What Is Referral Spam?

The majority of referral spam never actually visits your website which is why some marketers refer to it as “Ghost” spam. Even though this traffic never visits your website it still appears in your reports as legitimate traffic affecting total sessions, bounce rate, time on site, conversion rates and more.

On a major website where hundreds of thousands of sessions are recorded on a daily basis this traffic isn’t a major concern. On small business websites, this traffic can account for over 60% of daily sessions which causes major problems in month-to-month reporting, A/B testing, or other conversion rate optimization tests.

If this traffic never visits your website, why does it show up in Google Analytics? Google provides a developer tool called the Measurement Protocol. Among other legitimate uses, this allows developers and businesses to track behavior of their customers from a wide variety of different offline data sources and send that raw data to their Google Analytics account.

Unfortunately, this also opens the door for crafty spammers to force raw data into Analytics accounts by randomly attacking UA tracking codes, completely bypassing the website.


How Do I Identify Referral Spam?

There are a lot of ways to identify referral spam but the quickest is to review your traffic reports by clicking Acquisition > All Traffic > Source/Medium.


If the referring domain URL isn’t a big enough giveaway of the traffic source being spam, simply visiting the URL should remove all doubt.

Though some of these spammers have gotten more sophisticated, looking at % New Sessions, Bounce Rate and Pages/Session metrics are also a good indication. These metrics will usually be 100%, 100% and 1.00 respectively, another sign that this traffic never visits the website.

How Do I Remove Fake Traffic From Google Analytics?

Let’s be honest, there are thousands of blogs on this topic. Many are out of date, a lot include workarounds that simply don’t work, and others only eliminate some of the spam. What I’m going to outline below will work 100% of the time on new and old accounts. The only catch is you will need to update these filters as new spam domains continue pop up. Unfortunately, until Google provides a solution, there is no permanent “set and forget” fix for this.

Let’s get started.

My first recommendation, and I strongly recommend this, is to create a copy of your existing view. This copied view will remain untouched and unfiltered. This is a good safety net in case one of your filters begins filtering out legitimate website traffic.

To copy your primary view, click the Admin tab, select the view you’d like to copy and click Copy View.


The first three filters we’re going to add will block all future traffic from domains which are currently known to send referral spam.

To add our first filter click the Admin tab, select your Filtered View, click Filters, and enter a name for your filter keeping in mind there will be several.

Now this step is very important. You must select Exclude and choose Campaign Source. Many people fail to choose Campaign Source and can’t figure out why their filters aren’t working.

In the Filter Pattern field, copy and paste the string below:



Since there is a character limit to the Filter Pattern field, we need to create a second filter the same as the first, except in the Filter Pattern field paste:||||videos-for-your-business||video—production|success-seo||seo-platform|||rankscanner||

… and a third filter like the previous two using:||||^|

The fourth and final filter we are going to create is a Hostname Filter. I mentioned that the far majority of this traffic never actually visits your website, thus, it never requests your actual hostname which is the URL used to reach your website (typically your domain name).

This can be seen in your Network report by clicking Audience > Technology > Network and selecting the Hostname tab.


Any traffic in the above screenshot that is not visiting my actual URL is spam. Almost 60% of all traffic! The Hostname Filter eliminates this spam from your reports by including only the traffic that reaches your website by requesting your actual domain name.

You create this filter much like the previous three. The difference here is you must select Include, choose Hostname for the Filter Field and enter your hostname in the Filter Pattern.


Congratulations! These four filters have just eliminated 99.9% of all referral spam from your future reports! Routinely adding new domains to the referral spam filters will keep this traffic under control and keep your future reports clean.

How Do I Clean Old Google Analytics Reports?

While the above mentioned filters will only fight future referral spam, you can still remove spam from historical reports using a single Custom Segment.

You can create a Custom Segment from any report, but I’d recommend going to Acquisition > All Traffic > Source/Medium. Once there, click + Add Segment > + New Segment.


Essentially we’re just going to recreate the four filters we created above, but as a single Custom Segment.

Click Conditions, and on the first filter select Hostname > Matches Regex and enter the hostname(s) you used in your fourth filter above.

Now we want to click the + Add Filter button.

Custom Segment filters default to ‘Include’, but it is very important that your second set of filters be changed to ‘Exclude’.

In the set of drop downs select Source > Matches Regex and paste the same list of spam domains from the first filter you created. Click the OR button and repeat this filter two more times with the respective list of spam domains.


If the Custom Segment you created matches the screenshot above you’ll notice the circular graph to the right reflect a smaller amount of traffic. This is the amount of site traffic that remains after all referral spam has been removed.

Once you save this filter, you can apply it to any report and any time frame.

Taking The Fight To The Spammers

Nothing can compromise an otherwise successful A/B test quite like inaccurate reporting. With these four filters created and your Custom Segment applied, you can ensure that the data you are basing important marketing decisions on is truly accurate.

Until Google releases a definitive solution to referral spam, bookmark this article and reference this as the most accurate and up-to-date guide on how to finally remove Google Analytics referral spam from your marketing reports.

About the Author: Dallas McLaughlin is a Digital Marketing Specialist at The James Agency, a full service advertising agency in Phoenix, Arizona. He blogs frequently at about Search Engine Optimization, Pay-Per-Click, and Social Media Marketing trends. If you have any questions, you can tweet him directly at @BossDJay.

  1. Thanks for the write up, Dallas! Question for you…. would setting a cookie with a custom variable and matching that variable in a Google Analytics filter work? I havent played around with this and maybe there are other implications…?


  2. It would have been nice if the author had made a reference to the source of much of the information he wrote about – my Definitive Guide to Removing Google Analytics Spam.

    He copied my filter expressions (rearranged, but identical) and even made several comments about the lack of a “definitive solution”, even though what he wrote is just a reworded version of the article I have been maintaining for well over a year.

    Nothing original here…

    Mike Sullivan

  3. Pawel Urbanski Mar 04, 2016 at 3:31 am

    Hi Everyone,
    I wonder why Google never copied the idea from email and let users mark chosen referals as spam? Given enough of votes, it should give quality data to do automatic filtering. Google would also get a list of suspicious domains that could be downgraded with ranking.

  4. Don’t forget to update your htaccess file.

    Just because GA isn’t reporting it, doesn’t mean to say it’s not happening. Referral traffic will be eating up hosting bandwidth.

  5. What if under

    Audience > Technology > Network > Hostname you see both:

    Do you create an include filter for both?

  6. This is everything but the ultimate guide on how to resolve the problem.

    Once again, having a fixed list based on a list of domain is not going to help as such a list can become old in due course.

    I’ve mentioned a better strategy a while ago, based on cookies, and even that one is not perfect, but at least I’ve been able to cut off 95/98% of spam traffic without touching the setup since one year.

  7. Bryan Barrera Mar 07, 2016 at 8:51 am

    Real useful information here.

    You should also mention to block this referral spam on your server not just within GA. Just because you remove it form GA doesn’t mean it is not happening behind closed doors.

    Thanks for sharing!

  8. Alex Bililovets Mar 09, 2016 at 6:48 am

    Google hasn’t publicly commented on it but there are some flags that GA team finally fixed referral spam problem


Please use your real name and a corresponding social media profile when commenting. Otherwise, your comment may be deleted.

← Previous ArticleNext Article →