Spam sucks. It sucks in your inbox. It sucks on Twitter and Facebook. It sucks as a canned meat (Ok, it’s really not that bad). But it especially sucks in Google Analytics.
Google Analytics (GA) is foundational for any website and the data gleaned for UX, SEO and a lot of other things is extraordinarily valuable. So, if your data is dirty, you might make decisions that you wouldn’t have otherwise. Not to mention it’s annoying as hell.
Luckily there are a few ways to kick GA spam to curb and save your sanity. Did i mention spam sucks?
Setup Filters
Filters make it pretty easy to filter out traffic from certain domains, countries or to hostnames. If you’re unfamiliar, go to GA > Admin and you’ll see the screen below.
You’ll notice 2 areas for filters. On the left is for the entire Account and the right is just for a certain view. For referral spam I like to use the Account level filter to avoid repeating filters across views.
Ok, now that we know where filters live, let’s add one.
- Select Filters
- Click + New Filter
- Give your filter a name like Referral Spam Destroyer
- Select filter type of Custom
- Click the Exclude radio button
- Select the Filter Field of Referral
For the next step, I like to use regular expressions. This avoids adding a bunch of exclude filters for each spam referrer. It also makes it pretty easy to add a new spam domain when you spot it. And if you set it at the account level, it’ll add it to all views.
- Add the below to the Filter Pattern
(best-seo-offer|buttons-for-your-website|semalt|4webmasters|trafficmonetize|free-share-buttons|free-social-buttons|event-tracking|Get-Free-Traffic-Now|event-tracking)\.(com|org|net)
Copy it all and click Save.
To add new domains, just add a ‘|’ along with the domain (no subdomain or TLD).
You can also use the above method to stop direct traffic spam to random hostnames. Simply select Hostname instead of Referral and follow the steps.
Referral Exclusion List
If you aren’t comfortable with RegEx, then you can add each referral domain in the Referral Exclusion List in the Admin section.
- Go to Tracking Info under Property
- Click Referral Exclusion List
- Click + Add Referral Exclusion
- Click Save
This will do the same thing and exclude referral traffic for the views, just a bit tedious IMO and can’t be copy/pasted easily like the above RegEx filter.