CUSTOM FILTER · 6-MINUTE READ · By Paul Koks on October 10 2016
Google Analytics collects data at the property level, but you have the powerful option to create separate reporting views. Most often the difference between what data is being collected in each view is made through setting up a set of filters.
Segmentation is what makes your Google Analyics data reliable and actionable. There are different techniques to segment your data. You could use (advanced) segments, secondary dimensions, custom dimensions, but also filters. In this post I will describe five different filters you should consider setting up. Let me first explain a bit more about filters.
Google Analytics Filters
Setting up filters requires you to have “edit” rights on the account level. This is because filters are stored on the account level and are applied at the reporting view level.
This might cause problems if you work as a consultant and the company you are employed at has multiple properties installed in their account. Sometimes they don’t want to give you access to all their web properties. So make sure to sort this out at the start! Keep in mind:
- Filters permanently affect the data being collected in the reporting view.
- Filters can only be used on the dimension level; so you can’t set up filters on a metric.
- Filter order might matter if you apply multiple filters to one view.
- Apply filters to a test view first before you add them to your main data view.
- There might be a short delay (up to a few hours) before applying a filter affects your data.
I recommend to first experiment with applying segments in your reporting environment before you start working with filters. Segments temporarily affect your data and are in that way harmless. Once you understand how they work you can move on to filters.
1. IP Address Filters
In order to collect accurate data, you don’t want your internal sessions to show up. I recommend to use filters on IP address to filter out as many “known” sessions as you can. These sessions don’t reflect usual client or prospect behavior.
Normal IP Address
Filtering out single IP addresses is easy. Just head over to an IP address checker and copy the address from the screen. The next thing you need to do is set up the filter in Google Analytics and apply it to the main view:
Be careful to select “exclude” instead of “include” when setting up this filter. If preferred, you can use a predefined filter as well:
You are allowed to set up multiple exclude filters of the same type so there is no need to add all IP addresses to one exclude filter.
IP Address Range
A lot of companies have a range of external IP addresses in use. If this is the case, you need to use a regular expression when you set up this filter. Here is an example:
- First IP: 188.8.131.52
- Last IP: 184.108.40.206
The IP Range Regular Expression Builder comes in handy now:
Now you can create a RegEx filter in Google Analytics:
In this case you can only use a “custom” filter. A predefined filter won’t do as you can only select “that are equal to”, “that begin with”, “that end with” or “that contains”. To conclude, custom filters handle the more advanced stuff if compared to predefined filters. In my opinion, once you know how to use regular expressions, it might be wise to just use the “custom” filter option!
2. Lowercase Filters
The second type of filters are the so-called lowercase filters. I use these filters as an extra safety net for getting the naming structure right. At a minimum make sure to set up a lowercase filter on:
- All campaign tracking parameters (utm parameters)
- Search term (internal site search)
Let’s take a look at an example below:
Getting campaign tracking right is crucial. These filters are really useful to correct certain mistakes. For example:
- Alex uses Email to define Email Campaigns
- Mick uses email to define Email Campaigns
On default, Google Analytics will register both “Email” and “email” as a medium. However, setting up this filter will force all characters of campaign medium to be lowercase. Very useful since all sessions will now registered under “email”! I recommend to set up a lowercase filter on all different utm parameters (five in total). In addition to that you want to have your internal site search terms to be in lowercase as well. Capital characters don’t have any meaning in the site search reports. The same counts for hostname; make sure Google Analytics registers only lowercase characters here!
3. Device Filters
In-depth cross-device analysis and optimization can only be done if you can follow your visitors across multiple devices. In reality this is often not the case as we can’t easily apply the user ID feature in most cases. Using device level filters is great if you want to analyze your devices separately and are tired of sampling. It is very easy to set up. Just head over to the filter section and fill in the details shown below:
This filter – if applied at a specific view – allows you to isolate mobile traffic. All the reports you will see are fully focused on mobile. You don’t have to use any segments and it’s possible to view your goal funnels for mobile as well! Non-premium funnels cannot be segmented in another way. Keep in mind that you do want to have a reporting view where all device types are measured. Sometimes you simply want to quickly compare the different devices types or have multiple device segments applied within the same data environment.
4. Traffic Channel Filters
There might be several reasons why you want to set up traffic channel filters. For example, you have hired an SEO agency and want them only to have access to the SEO numbers. Or you don’t want another party to have access to your Google AdWords numbers. In both cases filters are your best friend! In the first example you want a certain company to only have access to your SEO numbers. SEO traffic is measured under medium = organic. The following filter will help you out:
The reporting view where this filter is applied will only collect organic/SEO data from this point on. Make sure to immediately apply this filter after you set up the separate view if you don’t want any other traffic to appear in this view. Please note that you are not able to set up filters on (default) channel groupings. You should use segments if you want to segment on a specific channel group. Channel groupings are especially useful if you have messed up your campaign medium/source structure in Google Analytics. In addition they more accurately measure your social traffic.
5. Search and Replace Filters
I won’t give any specific guideline here, because the way you use them depends on your unique situation. Search and replace filters can help you to:
- Replace URLs with difficult to read product IDs in product name based URLs.
- Quickly correct incorrect media name types.
- Prevent duplicate content URLs from showing up in Google Analytics by removing technical parameters.
I am just touching the surface of what’s possible with these type of filters. Let’s assume you run a campaign and a third party agency made the following mistake:
- Utm_campaign = witer 2016 instead of winter 2016.
- They are not able to replace this value and the campaign runs for another two months.
You want to keep your data as clean as possible. So if you notice this issue soon enough, you can correct future sessions from this campaign by using this filter:
It’s as easy as that! There are many more ways to use filters in a smart way. These examples will unleashen your creativity to create and apply filters that match your unique situation best. I cannot stress enough that you should:
- Keep a raw reporting view (with no filters applied).
- Have a testing view (where you apply your filters first).
- Use the “verify” filter option whenever possible; it will help you prevent making mistakes in the first place.
How to Get it Right
A few more concluding thoughts:
- Plan out your account structure (with properties and reporting views) first.
- Think about which filters you need in each of your reporting views.
- Add all filters to your account.
- Test your filters first if you are unsure or relatively new to using filters.
- Check each of your reporting views and add the filters that you need.
- Make sure your filter order is set up correctly. One filter can influence the outcome of the other.
- Watch the data flowing in (real-time reporting, debugging tools) and correct the setup if needed.
Well, this is it from my side. I hope you have learned some cool, new stuff about Google Analytics filters! I am happy to hear your thoughts! What are your favorite filters and how do you use them?
About Paul Koks
Paul Koks is an Analytics Advocate at Online Metrics and a guest writer for Supermetrics. He is a contributor to industry leading blogs including Kissmetrics, SEMRush, Web Analytics World and Online Behavior and the author of Google Analytics Health Check. Paul helps companies to capture valuable insights from simple data. You can find him on Twitter or LinkedIn.