Skip to content

Over the past few months I have noticed an increased amount of Google Analytics spam traffic (particularly referrals) on the websites I manage.

Most recently, having launched a site and checking a week later to find it had already had 500 hits despite not promoting it yet, I decided to investigate further.

I discovered that almost all of this traffic was spam, rendering the real traffic data practically useless. I’ve done some research into how to clean it up to restore the accurate data and thought it would be useful to share my findings.

Part 1: Spotting the Spam Traffic

First off I had to find out where all the traffic was coming from so I checked the Acquisition tab.

Google Analytics acquisition data

Google Analytics acquisition data. Note the large number of direct and referral traffic as well as their high bounce rates.

Clicking into the referral data reveals the source of the referrals; a whole host of spammy websites!

Google Analytics spam referrals

Google Analytics spam referrals (showing 10 of around 70 sources). Note the shady domain names, high bounce rate and minimal session durations!

So what are they and why are they linking to my website? Well, I discovered that most aren’t even visiting the site at all and the ones that do are robots.

Delving a little deeper by adding a secondary dimension of Hostname, the spam referrals tended to be split into two main categories.

Google Analytics spam referrals with hostname

Google Analytics spam referrals with the Hostname displayed. If the Hostname is anything other than my website or is (not set) it’s probably a spam hit.

Ghost Referrals

These ‘visitors’ haven’t actually visited the site at all. The Hostname column refers to where the visit took place. In my case my real traffic should have a hostname of because it’s the only place I have my Analytics code (You could alternatively put it somewhere else like a Paypal checkout if you have a shop).

Looking at the Hostname data of where the Analytics code tracked these hits, it’s not set to my website address so these are spam hits because they even take place on my website! Seemingly, these hits show here because a website in a dark corner of the internet has a matching tracking code.

The vast majority of ghost referrals can easily be spotted as they have a hostname of ‘(not set)’. Others may be set to Apple or Amazon to try and disguise themselves. Either way, unless the hostname shows a valid source it’s false and needs removing.

Bot Crawlers

Bot crawlers such as Semalt scour the web for purposes unknown, visiting your website and instantly leaving again. These are easily identifiable as the results with a session duration of 0.0 seconds and a 100% bounce rate.

Since the bot crawlers do actually visit my site the Hostname does say my website. However, the name of the source should give away whether it’s shady or not.

IMPORTANT: If you want to investigate a referral address, DO NOT VISIT THE SITE as it could have a virus or something nasty waiting for you. Do a Google search instead as this will tell you all you need to know about the site without having to actually visit it.

When Life Sends You Spam, Make Spam Fritters

Looking at the direct and search traffic revealed similar results. A massive chunk of the recorded traffic appeared to be ghost hits, clearly identifiable by the dodgy hostnames.

OK, so we’ve identified that there’s clearly a problem here! But fear not as next I’ll explain how I’ve restored the stats to their former glory!

In part 2, I’ll explain how to clean up you Google Analytics data using a filtered segment and in part 3 I’ll show you how to create a new filter to block the spam data from your future statistics.

Thanks for reading! As ever you can get in touch with me on Facebook and Twitter.

The PJWD Newsletter

Get helpful advice on web design, digital privacy and sustainability into your inbox once per month.


Helpful website advice in your inbox

The monthly PJWD newsletter is full of tips and advice on web design, digital privacy and sustainability (plus dog photos).

Get the PJWD Newsletter