Referral spam traffic in your Google Analytics account is a persistent problem for marketers, and it's only increased in severity with the onslaught of referral spam. It comes from all types of sources from social buttons, adult content sites, and sites that seem to exist for no other purpose than to spam.

Referral spam can really throw off your analytics in a very short period of time. The very first time I saw this happen I was pretty excited about the huge lift in referral traffic, but I wondered why it was happening. So, when I looked closer I was a little disheartened because it wasn't real referral traffic - it was spam. That started a quest to uncover the truth behind the referral traffic and what I could do about it.

Why should I care about referral spam?

This has a two-part answer, and the first is a pretty simple answer - it skews and screws with your analytics. It corrupts your data.

This can lead to making a wrong decision based on faulty data. These troublesome sources of traffic create misleading patterns which can lead to incorrect conclusions.

Heavily visited websites might not notice a few hundred hits a month, but for most websites that's enough to traffic to obscure legitimate traffic and make analysis a challenging, and misguided undertaking.

What does spam do to your data?

  • Greatly increases overall bounce rate.
  • Decreases overall time on site.
  • Falsely increases sessions.
  • Obfuscates referral traffic performance.
  • Hinders goal conversion & location data.

The second part is something that I hadn't considered, but is really critical. Depending on the referral traffic volume, it can put unwanted stress on server load and security. These unsolicited visits will tax the server resources unnecessarily.

Why should this concern you? Overload your server and you slow load times for your website. This translates to higher bounce rates and lower rankings. Google factors user experience into how it ranks websites.

What is Referral Spam?

There are two types of referral spam: ghost and crawlers.

Ghost spam never actually interacts with you site, it sends fake visits to the Google Analytics server by generating random tracking codes (UA-XXXXX-1).

Crawler spam does access your site. The spam bots crawl your pages as if they are real human visitors. They ignore your robots.txt file, and when they leave, they leave a record in your analytics that looks like a legitimate visit.

Crawlers are harder to identify because they know their targets and use real data. To help determine if suspicious referral traffic is real or a bot, try checking it against one of the many lists you can find on the Internet. This list of spam bots was last updated on May 30, 2017.

How Do I Stop Ghost and Crawler Referral Spam?

2015 is when spam really became a prevalent problem for webmasters and marketers. Although Google hasn't publicly said anything about the spam issue, some people are talking about a decrease in referral spam.

Spammers will spam. Google may or may not be doing something to deal with it, so in the meantime here are two approaches to dealing with the issue of referral spam.

Block via .htaccess
The key to stopping referrer spam is to block it before it has a chance to register on your site as a referrer. One of the most effective ways to stop referral spam from accessing your site is to block them in your .htaccess file.

Warning: The .htaccess file is a extremely powerful. It dictates how a server behaves, and one character out of place, and you can take down the whole site. If you’re not familiar with .htaccess or aren’t comfortable making the edits, make sure to work with your IT.

Analytics filters
The .htaccess protects you from any future sessions being impacted by referral spam, but it won’t affect the sessions that have already happened. This is where Google Analytics filters come in. Set up filters by country in analytics to remove the historical data, as well as to help filter out any other bots you might find from select countries in the future. For most North American-based companies, they will not be expecting legitimate traffic from countries like Russia, Brazil, or Indonesia, so blocking these countries wouldn't result in a loss of potential customers. Follow the steps below to set up the filters.

Setting up Filters to Block Crawler Spam
First, click on the "Admin" tab at the top of the page. On the view column you will want to create a "new" view so that you still have an unadulterated report of all traffic in Google Analytics. You can named something like, "Filter Bots." After you have your new view selected, click in to the "Filters" section then select the "+New Filter Button."

Setting up filters is pretty simple if you know what setting to use. We're filtering out countries like Russia, and India, so we're not going to be jeopardizing any potential business from these countries, but we will block their traffic. You can add more filters as you need them.

You can name the filter anything you like, but a simple approach is to just type “block [insert country here].” Next, choose the filter type “custom.” Choose “country” from the “Filter Field” drop down. The “Filter Pattern Field” is where you actually define what countries you are filtering, so make sure you spell them correctly. You can double check your filters by using the “Verify This Filter” button. A graph will pop-up and show you how many sessions will be removed from the last seven days.

Go to "View Settings" and select the “Bot Filtering” checkbox. It doesn’t hurt, it's easy, and maybe Google will decide to block some of these spammers.


There are certainly several other ways to solve the problem of referral spam in Google Analytics, and this is just one approach I like to use. Here are some additional resources if you're looking for more information on dealing with the problem of ghost spam or crawlers.