You’ve probably been there and don't even know it yet.
Your analytics are crowded by them. I know what you’re thinking:
"Wow, that's great! Somebody is linking to my website and I'm getting a lot of referrals from there!"
But the reality is not that good.
You actually aren’t getting any traffic. There are no visitors coming to your website from referring website. And what’s worse, it’s messing up your Google Analytics reports.
Why, you might ask, am I receiving this phantom traffic?
Well, these non-visitors shouldn't be counted since they've never been to your website. What you’re getting is distorted by fake data.
So, who is actually interfering with your Google Analytics?
You can find out who is giving you ghost referrals by looking under Reporting > Acquisition > Referral. Usually, the referrers are something like:
- or eveneditors.choicexxxx.hulfingtonpost.com
That's not a complete list, as ghost referrers are constantly evolving. Because they are growing and changing their structure and technology, we will probably never be able to get rid of them completely. However, this tutorial you should be able to eliminate most of it.
How to Remove Ghost (or Other) Spam Referrals From Google Analytics
There are couple ways to do this, and I'll explain each of the steps later in article:
- Using Google Tag Manager (set up an exception where you don't fire tag if it the referrer doesn't match the regex)
- Google Analytics Filters (filtering ghost referrals from defined sources)
- Placing cookies into visitors’ browsers and checking in analytics that this cookie was placed
#1 Before You Start Doing Anything in Analytics, Back it Up
Your data is valuable. Anytime you you do anything that would influence the structure of it, you should do backup first.
There are many ways to back up Analytics. Always preserve your raw data.
For example, my Analytics looks like:
To clarify what each of these are:
- Unfiltered view: this is just raw data without any filter applied
- Test view: on this view I'm testing my filters before applying them on my main view
- Master view: filtered correct data with goals and custom segments and filters
The procedure with my GA account is simple. Before I apply my filter on master view, I'm testing it on this view because I don't want to corrupt my valuable data.
#2 Filter Ghost Traffic by Wrong Hostname
So go ahead and open your Analytics. Click on Audience > Network. Once you open it, click to Hostname and what you see are all hostnames that visitors used to access your analytics.
You of course don't want to run your Analytics script on domains other than yours. In the image above you can see darodar.com and other ghost referreres that are messing with Analytics.
To filter this traffic, click Admin. On the right column select the right view where you want to apply your new filter and click Filters.
Then click New Filter button:
Select “Custom” in Filter Type and choose Include.
Now File Pattern should be regex matching your hostname. On my website it's this: ^(www.)?audienti.com$ and it works whether the hostname is with or without www.
This should work and filter out any traffic that doesn't happen on your hostname.
#3 Filter Out Traffic from Bad Refferrals
First, filter to remove traffic that happens away from your domain.
But what if there's a spambot that enters on your website?
Well, there are two simple solutions:
First solution is to create a new filter.
Head over to your Filters, click New Filter (the same as it was before).
Select Filter Type to be Custom, Filter Field is Referral, and Filter Pattern is this long regex (source):
And there’s also a feature (not particularly efficient) that Analytics provides to filter out all spiders and bots. You can find it in Admin > and under your View choose View Settings and scroll down to Bot Filtering and check the option.
#4 Filter Spam Referrals Traffic by Placing a Cookie
Solutions mentioned above won’t last forever because as you can see, there are more and more spam bots being created every day.
Although, here’s one solution that has really worked for Audienti website. I found it on Lunametrics blog, but tweaked it little bit.
So the principle is simple:
- You expect that a physical visitor of your website has a browser and that a spam bot doesn’t
- On your website you place a cookie on his browser
- Read the cookie in Google Tag Manager and pass it to Analytics
- Analytics will only include visitors with this cookie
I’m presuming that you use Google Tag Manager already on your website. If not, you should read this article on how you can improve your site performance by using tag manager.
Setting Up Cookies in Your Visitor’s Browser
Placing a cookie in your visitor’s browser is very easy to do. There are at least two ways how to do this. First option is to fire tag in Tag Manager, but in the next step we will read that a cookie in Tag Manager is most likely not going to be found in your Analytics (even if you set correct priorities).
Therefore I recommend you create a cookie manually and add this simple code snippet to your website’s footer script area (after </body> tag):
document.cookie = “dev-status=may2015; expires=Fri, 31 Dec 9999 23:59:59 GMT; path=/”;
Basically, you are creating cookie dev-status with value may2015 that expires in in far future. This is the value that we are going to read later in Google Analytics. If you placed it using Google Tag Manager, the same Google Tag Manager won’t find it in that same moment and in GA you won’t get the value in the first session.
Create Custom Dimensions
Head over to Analytics Admin, click to Custom Definitions and Custom Dimension.
From your Analytics mark down an index number because you are going to use it later.
Read the Cookie Value with GTM
Now to read the value of the cookie we have to create in GTM a variable that grabs value of our cookie. So in GTM go to Variables, click to New and proceed like this:
Once you’ve done that, head over to your GTM and select the Google Analytics firing tag. Open it and scroll down to More Settings, then find setting called Custom Dimensions. Insert your index and variable dev-status that you just created.
Include Only Traffic with Cookies
The next and final step is to get Analytics to recognize visitors with the cookie and include only those visitors into the final report.
We’re going to do that in Filters. So create new filter with these parameters:
This was the final step. Now you should be able to see correct data in your Analytics.
Whether you are marketer or you do more technical tasks on your website, you should always keep your data clean. Now you will be able to filter out this really irritating way of spamming. Do you have any questions or comments about this process? Please let us know in the comments.