What are Google Analytics filters? Differences between view filters and segments.
Usually in Google Analytics, we refer to filters when we want to segment our data into smaller, targeted groups which will inform our goals. Filters can be used to include or exclude specific subsets of traffic, unwanted data – (bot traffic for example) or to tidy up pieces of our information, such as replacing the slash on our URL addresses.
Is important to note that Google Analytics allows you to use filters at View level or at the Summary Table level. The View filters have a permanent effect on the data that is going to be collected in your used view. Therefore, it is imperative to allow only the users which know what are they doing to setup View filters.
By comparison, Table views can be used by everyone to slice through your Google Analytics data because doesn’t affect any data collection. As Table views, GA offers the Segmentation feature which is really handy, especially if you are sharing your reports with other parties from your agency, company or consultancy agency.
The main differences between Segments and View Filters are that the Segments don’t affect your future data and can be applied by anybody, while the View Filters can skew your GA data if are not used wisely and you need level access to be able to setup one.
How can you create a new Google Analytics filter?
Now that we covered the main differences between View filters and Segments, let’s focus on how we can create a View filter. Actually, a View Filter can be created at either Account or View level. The best practice is to create your filters at Account level and to assign them on your desired View(s).
To manage or to edit all your filters, you need to navigate to Admin tab and under Account select All Filters. (highlighted in blue). Also, if you want to have a filter only at a View level (for example you are using a custom dimension or metric) you can set it up using the Filters tab under View Column. (highlighted in red)
GA filter types
1. Predefined Filters
As with any other tool, there are some predefined features which we can use in our data manipulation or segmentation. It is the same case here. Google Analytics has a series of predefined filters that are easy to set up and no specific knowledge is required to take advantage of them.
These Predefined Filters are setup using a 3 level set of definitions as follows:
- Select filter type – Exclude or Include only
- Select source or destination – traffic from the ISP domain, traffic from the IP addresses, traffic to the subdirectories, traffic to the hostname
- Select expression – that are equal to, that begin with, that end with, that contain
Now that we have acknowledged our predefined filters, let’s have a look into some practical examples. One of our most used predefined filters is when we want to exclude any of our internal traffic because we don’t want to “bloat” our direct traffic.
IP addresses filter
Let’s assume our IP address is 220.127.116.11. Our Exclude Internal
Another common filter which we often use for our clients is the hostname filter. Let’s say for example, that we have a client – Example Ltd, who wants to understand the performance of one of their domains and they need a separate view for it.
After we created a new view in their Google Analytics account, we need to setup a hostname filter at View level so we can make sure our data doesn’t include anything else except that domain’s traffic. (Assumption: Example1.com is our analyzed domain)
Some important notes:
- Use only one include filter of the same type. For example, one include filter on medium=email and another include filter on medium=organic will result in a conflict and it is possible that no data will be collected. So, the solution would be to use a RegEx: email|organic to create a custom filter.
- Using different filters for different purposes needs to be managed properly and usually the filters order will influence what data is shown. So, as guideline, when you setup a new filter keep in mind that you probably need to setup a new view also.
- If your implementation involves only 1 domain, setting up this type of filter would help with spam traffic and also can be seen as a precaution in case others are hijacking your GA tracking code and placing it elsewhere.
2. Custom Filters
Custom filters in Google Analytics are considered to be advanced filters because some knowledge is required to understand how the available categories of filter are working and what the best way to use them is without skewing your data. Remember, the View filters are affecting your GA data from the time they’re implemented onwards.
The custom filters in Google Analytics are divided into 4 groups:
- Search and Replace
a.) The main categories with the Include/Exclude option are: content and traffic, campaign or adgroup, ecommerce, audience/users, location, event, application, mobile device, social and other. Basically, your possibilities are unlimited.
b.) Due to the way Google Analytics reads the uppercase and lowercase some data issues can occur. For example, if you have a campaign tagged as utm_medium=Facebook and other one as utm_medium=facebook, GA will report on those as two separate entities. To resolve this issue a Lowercase/Uppercase filter will help.
We prefer using lowercase filters instead of uppercase ones and one of the reasons is that Google by default is using lowercase format, in our case, for medium. We would recommend using lowercase filters for: Request URI, Campaign Medium, Campaign Source, Campaign Name, Campaign Term, Campaign Content.
c.) Search and Replace filters are really handy when you want to correct a utm parameter for example or if you have a slash on your URL end and you want it to be reported as a non-slash.
Let’s take an example: we have some blog articles which were created as a mini-series for the same topic: blog/knowhow/seo/tip1, blog/knowhow/seo/tip2, blog/knowhow/seo/tip3. We want to see these pages as one in our view in Google Analytics, therefore our filter will look like this:
The dot-asterisk (.*) means, in regex, consider any random combination of zero or more characters; in our case, any characters behind /knowhow/seo/. Search and replace filters can be applied to all areas except location based filters.
d.) Advanced filters are really useful in so many scenarios, but to use them you need to understand how regex works. Please use this opportunity to learn more about regex and you can start by using our Beginner’s Guide into Regex for Google Analytics/GTM.
One of our most used advanced filters is to instruct GA into showing the hostname along with the request URI. By default, Google Analytics, doesn’t do this in the page report, so with the filter help we can see the full address, especially if the same view is collecting data from two different domains.
Using filters can bring a lot of clarity and accuracy to your Google Analytics reports and there are virtually unlimited possibilities on how and when to use them. Now, let’s review some of the most important points from this ultimate guide for GA advanced filters:
- Always keep an unfiltered data view;
- View filters are future based (affect the data from the time of implementation onwards), cannot be undone and should be used as a long term segmentation strategy;
- Segments are really handy for ad hoc analysis, and don’t affect your stored data;
- Always use your Testing View as a first step for filters before moving them to the main view; this way you will be able to adjust any configuration and you are sure that no data was deleted from your Main View;
- Filters are useful for any type of scenario on any website (e-commerce, lead generation, blogs, etc.)
- Sometimes, view filters can take up to 2 hours to show any effect on your data.
- Use view filters wisely and keep in mind that more advanced ones require some regex knowledge.