Filtering Referral Spam from Google Analytics

If you are even a casual user of Google Analytics, then you have probably noticed in referrals from strange sites with names like:

best-seo-offer.com
buttons-for-your-website.com
www.event-tracking.com
free-social-buttons.com

…and the list goes on.

Not content to just spam search results, the spammers are now polluting our data. This referral spam is a plague and the big G is seemingly unable or unwilling to filter it on their end so it is up to us to make sure we are giving the cleanest data possible to our clients. Granted, like all spam-blocking activities, it can be like a game of wack-a-mole. Luckily, it only takes a few seconds to add a filter to Google Analytics once you know how.

But first, let’s take a look at what these spammers are doing and why.

First, let’s drill down a bit. From the Reporting page go to Acquisition > All Traffic > Referrals. This shows all of the referrals from external sources. Now, let’s filter for referrers with 100% bounce rates. That is always a good indicator of bot traffic. Not all referral spam will be 100% bounce but this gives us a good starting point. From here, we can identify some obvious spam domains.

Google referral spam in the wild

 

Now, let’s drill down and see where these referrals are really coming from.
best-seo-offer referral spam

Hey look! It’s our old buddies from Semalt.com!

semalt.com are spammers

Now you can just wash, rinse, and repeat through your worst offenders and make sure that you are not blocking legitimate referrals. For this client, we had several that really needed to go.

Now is the fun part. Setting up our filters.

  1. First, as a best practice, I always like to create a virgin unfiltered view just in case I muck things up I can see what the raw data looks like.
  2. Next, I setup a custom Campaign Source filter with the following settings:
    1. Filter Type: Custom
    2. Exclude
    3. Filter Field: Campaign Source
  3. For the Filter Pattern, we are going to get fancy and use a regular expression. A regular expression will match variants of the domains. For this example, I used the following:
    .*(event\-tracking\.com|affiliate\.iqoption\.com|rankscanner\.com|datehookup\.com|guardlink\.org|websites\-reviews\.com|100dollars-seo\.com|semalt\.com|darodar\.com|buttons\-for\-website\.com|free\-social\-buttons\.com|sharebutton\.net)
    You can edit to fit your own referral spam domains, just remember to use the \ to escape out the dots and dashes in the domains.
  4. Next, check your regex by clicking verify this filter at the bottom of the page. If everything is working, you should see something like this:
    Filtering Referral Spam with Regex

And that is it! This should result in some much cleaner data and you can continue to add to the regex as you come across new referral spammers. If you serve mostly local customers, you may as well set up a custom filter by demographic and remove traffic from foreign countries as well since those are probably bots anyway.

Next, I will take you one step further and show you how to create an advanced segment so that you can have a completely spam free view of your data to feed to services like RavenTools.