Google Analytics is a very powerful tool for marketers, in fact, it is the most used web analytics tool online today. As a wise arachnid once said, with great power comes great responsibility. If you want to get the most accurate view into your web traffic, you must be sure you are doing everything you can to block spam. This includes stopping a type of referral spam referred to as “ghost spam.”
This type of spam is actually more common than your typical referral spam. Most marketers are familiar with referral spam and know how to spot it, but what marketers should really be concerned about is blocking ghost spam.
Ghost spam is different than basic referral spam because it never actually hits your site. Instead, it goes directly to your Google Analytics account. How? Ghost spammers use Google’s Measurement Protocol which was created as a way for developers to send data directly to Google Analytics Servers. These ghost spammers only need a tracking ID to hit your Google Analytics with some false information.
Unlike referrer spam, you cannot block ghost referrals with an .htaccess file because, as we mentioned, they are not technically going to your site. Instead you can use a Valid Hostname Filter in your Google Analytics. Setting up this filter will turn you into a ghost (spam) buster. Finally, you don’t need to be afraid of no ghosts!
Here’s How to Start Ghost (Spam) Busting:
A Valid Hostname Filter is the recommended method for tackling ghost spam. This will take care of all kinds of spam, which includes referral, organic, or fake direct traffic. Before you do this be sure to have a list of all VALID HOSTNAMES to ensure you are not excluding any of your legitimate traffic. In addition, always have a view without filters so that you can check your full list; this can be helpful in case there are domains you end up accidentally blocking through the Valid Hostname Filter.
First you need to obtain a list of invalid and valid hostnames which is actually easier than you think.
Reporting > Audience > Technology > Network > Select Hostname at Top
Once you are in here, determine valid vs. invalid hostnames. How do you know? All of your domains are valid (your-domain.com) and then everything else is fake. Copy all of the valid hostnames and make an expression.
Keep in mind, if you have subdomains, you should also add them to this filter. Also, don’t be fooled by “Google.com” or other recognizable names listed as a hostname on the report. The only hostnames that are valid are those in which your UA code is implemented.
Now you will create your filter:
Admin Tab > View > Filters > New Filter
Once in Create Filter you will see the above. Click Custom and then Include Filter Field Hostname. You will then post your Regular Expression in the Filter Pattern field (ex. yourdomain.com|blog.yourdomain.com). Before saving it’s a good idea to take advantage of Google Analytics Filter Verification feature.
The above is a lot to take in, but hopefully this can serve as the guide you need to complete this process for your website. It’s important to have the most accurate information you can when it comes to reporting and being a ghost(spam)buster can help ensure you have the most accurate numbers for traffic on your website.