Stop Google Analytics Referral Spam in 30 seconds (or Less)

I’ve talked about ways to block referral spam in Google Analytics previously and also gave a few suggestions that worked for me. However after finding myself constantly having to filter out new spam sites, I found another easy way to stop this spam in a matter of seconds. No need for a programmer, no lengthy spam site list to review and virtually no technical skills are necessary for this solution. Best of all it will block referrer spam for the majority of websites running Universal Google Analytics.

I need to clarify something prior however. This fix won’t work if you a tracking anything externally using the Universal Analytics measurement protocol. As Himanshu Sharma explains you need to use it for tracking external devices:

This device/system can be a smart phone, tablet PC, digital appliance (like washing machine, coffee machine), point of purchase etc.

Now if you are not tracking uses of a washing machine, smart phone, coffee machine or your POS system in Analytics, there is a good chance this referrer spam fix will work for you. That’s probably what… 1% of you? 1/2 a %? Less?

So I am writing this assuming a good majority of you are not using Analytics at this level and just want to remove that pesky referral spam.

Now Let’s get to it!

The Lowest Common Denominator – Hostname


When going through all my referral spam I was not able to find something that was consistent among this spam. This referrer spam is structured like normal traffic. It comes from various browsers and it comes from a variety of countries and looks and feels like normal traffic. The frustrating this is that even the time on site and the bounce rates are manipulated in a way that makes this traffic look human!

See the screenshot below and the bounce rates and time on site numbers. Trying to filter normal traffic by low bounce rate or time on site won’t even work because there is no consistency there either.

referral spam bounce rate and time on site

This is the core reason why referrer spam is so difficult to remove. It looks normal.

So why does it look normal? The answer here is easy: they are pinging Google’s measurement protocol telling Google what to stick in your Analytics. They are creating traffic willy nilly and telling Analytics what to say. This isn’t bot traffic.. this is measurement protocol traffic designed by Google but in this case, working completely against it.

This brings me to the Hostname. All traffic that actually visits your website lands on your page and therefore there is a hostname attributed to it. What do we know about the referral spam? Well it’s not landing on your site or pages at all.. its using the external measurement protocol to manipulate your data.

Let me prove it.. check this screenshot out from an Analytics account we are managing:

Hostname referral spam removalThe ones shaded our are real referral traffic sources. The others are obvious spam sources. Can you see the lowest common denominator here? All the spammy referrer traffic is using the measurement protocol and coming through as (not set). All genuine traffic is coming through as your domain name (or any subdomain that you are measuring traffic for on your property ID).

So instead of excluding the suspect referral traffic, you simply need to show traffic that has your hostname(s) on it. This means just a couple of filters, not tens if not hundreds of domain exclusions.

This spam fix takes about 30-40 seconds… depending on the speed of your internet connection.

The first step is to login to your Google Analytics admin panel and go to the property view in the far right hand column. You can either edit and existing view or add a new one. I this example I am just going to add a new view altogether and do suggest you do the same if you havn’t done this before. As a minimum an annotation in your analytics data would be useful so you can identify changes in traffic for both yourself and your client.

remove referral spam new profile view
Either edit your current view or create a new one.

If you decided to create a new view you will then be asked to name the view. Call it whatever you like so you can identify this new view.

You can simply use a predefined filter with a similar setup to the below:

include hostname to remove referral spam

You can also set it to Traffic to the Hostname ‘That are equal to’ if you know that you only have one hostname you want to filter. I chose ‘That Contain’ because there are a few subdomains that I need to ensure are included in the filer.

I do also recommend you click the verify button as it will show you a good chunk of data that will be filters. These are my results:

verifying filter spam google analytics

As you can see the proposed filter removed the (not set) and a whole other bunch of sketchy domains.

Hit save and then monitor your referral spam. It should be almost completely gone from here on in. Not to say this will stop referrer spam for good or remove all types of referral spam but for 95% of the cases.. this should solve the problem.

My Disclaimer

I am confident the above will remove the majority of your ugly spam traffic. Not everything but most of it.

Secondly I would like to point out that this will work on most of the setups for Universal Google Analytics. However if you are using the measurement protocol to track devices or conversions into your Analytics this will not work. It will simply cut all your measurement protocol calls to Google Analytics which will ruin your traffic. Keep this in mind.

I hope that this will solve a lot of your problems when it comes to moving Google Analytics referral spam. Google has stated that they are working on a solution but timing for that is still up in the air. Until then, this should prove a relatively easy and straightforward method to kill pesky referral spam and clean up your precious data.