Google Partners Masterclass 2015 Insights Part 5: Getting Rid of Referral Spam From Google Analytics


Yesterday’s article was about Remarketing Lists for Search Ads, powered by Google Analytics, making it possible for you to target your search ads based on your customer’s past activity on your site, create deeper segmented audiences, customize your messages according to your user segments and save you the marketing budget for users you don’t want to re-attract. Today, we’ll talk about what everybody hates – Referral Spam and how to get rid of it!


Are your Google Analytics reports getting jammed up with bogus data from nasty referral spammers? Don’t worry. You’re not alone!

Throughout this post, I will be referring to great sources of information from the following authors and sites:

Let’s begin!


The Problem – Annoying referral spammers!

During the event, David discussed the types of Google Analytics (GA) referral spam. In GA, there are two types:

  • Nasty bots and spammy web crawlers

These are robots that actually visit your website and show up in your analytics reports as sessions, often (but not always) with a 100% bounce rate and 0 second duration. They may or may not identify themselves as bots and can be filtered out.

  • Ghost referrers

They are tougher to identify and deal with as they never actually visit your website but exploit the Google Analytics Measurement Protocol.

How is that possible?

David cited a blog post by Ben Travis of Viget that provides you with a solution on how to deal with referral spam. According to the post, with ghost referral traffic, spammers can “spoof” a session very easily by generating a simple program that sends fake HTTP requests aimed at different Google Analytics properties, so this ghost referral traffic doesn’t even hit your website.


The Solution – Crush them!

David presented 6 possible solutions on how best to get rid of these annoying referral spams:


Solution #1 – Enable Bot Filtering

Enable bot filteringSource: Cardinal Path

This can be done within Google Analytics Reporting View Settings. By checking this box, you can automatically exclude known bots and spiders from your GA data. Read more about understanding bot and spider filtering from Google Analytics in this post by Sayf Sharif.


Solution #2 – Use Valid Hostname Filters

Hostname filtersSource:

David advises to include ONLY your site hostname because ghost referrals are coming from other hosts. The article from Mark Hansen of Megalytic shows how to create a list of valid hostnames that shouldn’t be part of your reports. Additionally, according to the article of Mike Sullivan of Analytics Edge, “since spam referrers don’t know whose website the tracking ID belongs to (randomly picking numbers); they send the ‘referral’ using a hostname that is not one of yours. You can then create an INCLUDE filter that keeps only what was recorded from one of your valid web hosts”. It cautions users to make sure to identify ALL valid hostnames or else end up excluding valid traffic.


Solution #3 – Exclude Bots With Campaign Source Filters

Campaign Source filter


For those non-ghost referrals that actually visit your site, you need to create another filter that will exclude a list of known referral spam sources or domains. Read Mark’s post to know how you can implement this on your site and Mike’s post from Analytics Edge for more information on this solution.


Solution #4 – Use Advance Segments To Get Historical Data

Advance Segments


You can use advance segments to view historical data from before filters were implemented. Creating segments can help you select sessions that match your set criteria. Scroll down Mike’s post which shows how a single segment can include valid hostnames to remove ghost referral traffic and to exclude spam referrals created by crawlers.


Solution #5 – Use the Spam Insertion Tool

Spam Filter Installer


With over 400+ spam referral domains, Simo Ahava has written a post on this awesome spam filter tool which uses GA Management API. You can use this to remove referral spam by creating and applying filters. David added that this tool automates the process of adding bot filters across all accounts and then down to profiles you have EDIT access to. He notes that this tool can’t help with polluted Measurement Protocol hits, or with spam that doesn’t come in as referral traffic, or with spam that comes in as referral traffic but isn’t in the filters yet. See Simo’s post and follow the steps to get you started with this tool.


Solution #6 – Cookies and Custom Dimensions via Google Tag Manager

Cookies and Custom Dimensions via Google Tag ManagerSource:

In Sayf’s article on Eliminating Dumb Ghost Referral Traffic in GA, he walks you through 5 steps to block out traffic from outside of your website with a combination of tracking changes and filters within Google Analytics or with Google Tag Manager (GTM). Below are the steps.

  1. Set a cookie on your website for anyone who reaches your website
  2. Create a Custom Dimension
  3. Grab the cookie value via GTM
  4. Pass in the cookie value
  5. Filter out the bad traffic by including only traffic where your Custom Dimension is set to your specific value

Get more details here.

You’re now only collecting data for those you cookied on a visit to your website.

Time to celebrate?! Not just yet…

Unfortunately, David and Sayf points out that it’s possible for ghost traffic to find and mimic that custom dimension too.

It should be clear by now that there is no long-term solution for getting rid of those nasty referral spams. However, by implementing the solutions above you can get cleaner and more accurate data from GA. Want to know more? Check out Carlos Escalera’s article complete with awesome visuals on how to keep away referrals spam with 2 filters.


Up Next…

For the sixth part of the Google Partners Masterclass 2015 series, our article tomorrow will discuss about another Google update which is on the enhancement to Dynamic Search Ads (DSA). With the new DSA, Google recommends categories based on the content of your websites and make suggestions on text ads. Find out more on tomorrow’s post.