If you have looked at your Google Analytics account recently you've probably noticed a lot of traffic from sites that you've never heard of. If you think it looks like spam, you're right. It's either referrer spam or ghost referrer spam (technically these are different things, but they have the same affect on your analytics data).
Below we will describe how to remove ghost referrer spam, the kind that appears without anyone visiting your site. The fact that no one has actually visited your site is why it's called "ghost" spam. Another kind of referrer spam is when people, or more often, bots, actually do visit your site for the sole purpose of generating referral traffic in your analytics.
Recently we have seen ghost spam from domains like lifehacker.com, addons.mozilla.com, abc.xyz, and the list goes on. Assuming you are experiencing the same, you are not alone.
Ghost spam is a new form of spam where a 3rd party makes a fake request directly to Google Analytics' tracking systems using your site's Google ID.
The reason for this type of spam, much like other types of spam, is to get your attention. The spammers hope that when you see these referrer domains in your analytics, you will visit the domains to find out who they are. The reason can be to market their product to you, or to generate affiliate traffic, or potentially to infect you with malware or spyware. Whatever the reason, we don't want it in our analytics!
This screenshot shows some examples of recent ghost referrals in our analytics. You may notice that "reddit.com" is included in the list. The method we will show you below for removing ghost referral spam from your analytics will remove only spam from the reddit.com domain, but it will not remove legitimate traffic that you're receiving from reddit.com threads. So don't worry, you won't lose any data on legitimate referrals.
There are ways to block off specific referrals, but that is a cat and mouse game that requires constant updates on your part, as changing the referral URL is very simple for a ghost spammer to do. And they do it often.
To remove ghost spam from our analytics once and for all, we're going to create a filter that tells Google to only accept analytics data that is sent directly from your website to their systems, and it will block any that come from a 3rd party spammer.
Once you apply the filter below, you will still see all the valid information from real referrers, but you will not see any of the fake referrers (even in Google Analytics Real-Time overview)
Step 1) Create a New Filter
A) Login to your Google Analytics account & click the "ADMIN" link tab at the top.
B) Select your website from the Account drop down.
C) Click the "All Filters" Link
D) Click the "Add Filter" button.
Step 2) Define the Filter
A) Enter a filter name ("No Bots" or any other name).
B) Select "Custom" for Filter Type.
C) Select the "Include" radio button.
D) Select "Hostname" in the Filter Field drop down.
E) Enter your website URL in the Filter Pattern box. Use the format shown in our screenshot, including the "\" after the "www" and before the ".com" which tells google to accept traffic from all forms of your domain.
Step 3) Apply the Filter
A) Select "All Web Sites Data" under Available Views (or only the current domain if more appear)
B) Click the "Add >>" button to move it to Selected Views.
C) Click the "Save" button below.
Congratulations, your data is now free of ghost referral spam!
(This change will only affect future stats, it will not apply to past data.)