If you are even a casual user of Google Analytics, then you have probably noticed in referrals from strange sites with names like:
…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.
Hey look! It’s our old buddies from Semalt.com!
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.
- 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.
- Next, I setup a custom Campaign Source filter with the following settings:
- Filter Type: Custom
- Filter Field: Campaign Source
- 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:
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.
- 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:
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.