Looking at my Google Analytics data I noticed a relative increase in traffic on coding-dude.com during the November 2016. I tried to find out where this traffic came from and the referral overview showed all sort of dubious websites like abc.xyz and lifehacĸer.com (notice the “ĸ” character as oposed to k). Of course this is not real traffic and it’s part of some black hat SEO techniques meant to drive traffic to these shady sites. The websites are stuffed with links and meaningless content.
This technique is called referral spam and after searching the net a bit I realized that the problem is extremely wide spread reaching websites as big as thenextweb.com. It’s source is actually a Russian hacker that managed to create a piece of code that feeds data directly into the Google Analytics endpoints. The purpose is to make web masters access these sites while trying to investigate how traffic is coming from them and therefore generating traffic on the spam websites.
So how do we block referral traffic in Google Analytics to avoid inclusion of spam referral?
Who is this post for?
I’ve written this post for web masters or blog admins like myself who want to get real traffic data from Google Analytics reports and block spam data. That is, for webmasters that want to filter out any referral spam information and more specifically filter out abc.xyz or lifehacĸer.com (lifehacker.com) from the Google Analytics reports. Here’s a sample from my Google Analytics referrals overview where you can easily spot the spammers:
Is Google Analytics Spam Affecting My Website Rankings?
The short answer is NO. There is no negative impact on your website rankings, however, because Google Analytics data is polluted by this spam it will be more difficult to get an overview of the real traffic on your website.
So my opinion would be to somehow remove this spam data from the Google Analytics reports, but how do we do that? See below my proposed solution.
How Do I Remove Referral Spam From My Google Analytics Data?
Since this kind of spam goes directly to Google Analytics there is not much you can do on your website to stop it. However, what you can do is filter out spam referrals from the Google Analytics data. In order to do that you need to create a filter in your Google Analytics.
First go to Admin and select Account > Property > View > Filter.
Define a new filter by pressing the Add Filter button.
Give the filter a name, choose Custom as the Filter Type. Then check the Exclude box and choose Referral in the Filter Field. So, we are defining a filter to exclude all referrals matching a certain string. The string is a regular expression. Since we want to exclude all incoming traffic from
.xyz and the
lifehacker.com sites the regular expression will look like
Save the filter and you are done.
Why do I still see spam traffic in my Google Analytics
As I’ve later found out, the xyz and lifehacker spam technique is not the only one used by spammers. In my case I had to also add another filter based on the user language identifier.
Every visit to your site is tracked by Google Analytics by the use of a tracking number associated with the user visiting your site. Attached to the user id are all sort of information including which is the language of the user.
Apparently the spammers have found a way to feed a fake identifier as the language id which in my case looked like this:
"Secret.ɢoogle.com You are invited! Enter only with this ticket URL. Copy it. Vote for Trump!"
I had to add an extra filter the same way as described above, but this time in the Filter Field I chose Language Settings with the filter pattern
Congratulatulations, You Have Now Blocked Referral Spam in Your Google Analytics Reports
The filter is setup and you will no longer see the spam data in your Google Analytics data. Please note that the filter does not apply for past data, but future data will block referral traffic in Google Analytics coming from the spam websites.
Hope you found this post useful. Spread the word, since the only way to stop this kind of spam attacks is to have well informed web masters that would render useless these kind of attempts.