Google Analytics is one of the most important tools you can utilize to keep track of the performance of your website as a whole, in addition to the performance of your content and the behavior of the users to your website. If you haven’t begun to utilize Google Analytics for your website yet, you’ll want to get it set up as soon as possible so you can improve your strategy and reach even more potential clients. If you are already using Google Analytics and have noticed a large decrease in session duration or an increase in traffic from random locations (i.e. out of country), it can be due to spam traffic, especially if you haven’t done anything different to your website.
By setting up a filter in Google Analytics, you’ll be able to filter out the spam traffic to your website and be able to see real, genuine traffic to your website.
Google Analytics Filters 101
In order to create a filter in Google Analytics, you will need to have edit permissions in the account level. If you have access to the Google Analytics account you would like to make a filter for but are unable to actually set the filter up, ask the account owner to give you the correct permissions. Once you have enough access, you’ll want to make an unfiltered view of the data.
Keep in mind that filters don’t work retroactively and any changes made by the filters are permanent. If you set them up incorrectly, you could lose valuable data.
Types of Filters
There are two types of filters that can be set up in Google Analytics: predefined and custom.
To filter out spam traffic, you’ll want to set up a custom filter. Custom filters allow regular expressions and are a lot more flexible. Through custom filters, there are five types: exclude, include, uppercase/lowercase, search and replace, and advanced.
How to Create a Filter for Spam Traffic
1. Log into your Google Analytics account and go to the Admin panel
2. Under the “View” column, select “Filters”
3. Select the red “+ Add Filter” button
4. Configure a “Valid Hostname Filter” to remove spam traffic from your data
Filter Name: Include valid hostnames
Filter Type: Custom > Include
Filter Field: Hostname
Filter Pattern: Hostname you created
5. “Save” the filter
6. Once you have your hostname filter set up, you’ll also want to set up a filter for crawler spam. This will be done the same way as above, but with the following:
Filter Name: Exclude crawler spam
Filter Type: Custom > Exclude
Filter Field: Campaign source
Filter Pattern: Crawler spam source name you created
Once these steps are completed, the spam traffic will be filtered out and the valuable data will remain.