You can control the data included in your reports using filters. They’re useful because once you’ve created them they’ll continue to be applied, so unlike segments, you don’t need to add them each time you want to perform analysis in your reports.
We’re going to look at 8 essential filters you should consider applying to your data in Google Analytics. If you like, you can jump straight to the filters:
- Exclude internal traffic
- Lowercase campaign tags
- Ensure data accuracy
- Lowercase page URLs
- Lowercase site search terms
- Add domain name to reports
- Only include a specific domain (or domains)
- Search and replace
In this post we’re also going to answer the following questions:
- What are filters?
- How do you create filters?
- What types of filters can you create?
- Can I apply multiple filters?
- What are the critical filters I should create?
- Which filters should I avoid?
Let’s get started!
What are filters?
Filters allow you to control which data is included (and not included) in your reports. And unlike segments and table filters, view filters permanently modify the data that’s available in a reporting view. This might sound scary, but there are times when you might want to permanently prevent data from appearing in your reports.
The most common view filter that people create is a filter to exclude internal traffic from showing inside Google Analytics. This is where you remove your own visits so that you have cleaner, more accurate data in your reports. If you work at a large organization, then internal visits could have a significant impact on your data and can skew important metrics like conversion rate.
Now that we’ve covered what filters are we’re going to look at how you can create filters inside your account. If you’re new to Google Analytics and you’re not familiar with terms like views and properties, then I recommend downloading my Google Analytics Glossary before you continue.
How do you create filters?
Filters can be applied to one (or more) of your reporting views inside your Google Analytics account. You’ll need edit-level permission for the view to create and apply filters.
To create a filter navigate to ‘Admin’ and then select ‘Filters’ under the view column on the right (or ‘All Filters’ under the account column on the left).
It’s best practice to have at least three views for each property inside each Google Analytics account. I recommend checking that you have the following views created for each property:
- Primary reporting view – this is what you’ll use for your regular reporting and analysis. You’ll apply filters to this view that remove your internal visits and any other filters that are needed to provide a cleaner, more accurate set of data.
- Raw reporting view – this is a backup set of data. It won’t have any filters applied, and hopefully, you’ll never need to use it.
- Test reporting view – you’ll only use this view for testing. For example, you can apply new filters to this view to ensure they work as you expect before they’re applied to your primary view.
If you’re setting up these views for the first time, then check to see if any filters are applied to the view that already contains data. If the view already has appropriate filters applied, then name it something like ‘My Company – Primary’ so that it’s clear this is your day-to-day set of reports. Then you can create a new view and name it ‘Raw’ and another called ‘Test’. To create a new view click ‘Create View’ at the top of the view column on the right.
Now as you’ve probably guessed, I recommend adding filters to your testing view before you add them to your primary view. It’s better to be safe since there is no undo when it comes to your data in Google Analytics!
What types of filters can you create?
You can create filters using pre-defined templates, or you can create custom filters. When you create a pre-defined filter, you can choose to exclude (or only include) traffic based on:
- ISP domain – allows you to filter based on the domain of your ISP (Internet Service Provider). This is only useful if you’re with a larger organization (think multinational corporation or university) that has its own dedicated internet.
- IP addresses – when you connect to the internet you’ll be using an IP address. Most retail (domestic) internet providers give you a dynamic IP address which can change. So the best way to filter data using IP addresses is to ensure you have a static IP address which doesn’t change.
- Sub-directories – you can use this template to only include (or exclude) traffic from one of your website’s sub-folders. For example, if you wanted a reporting view that only contained traffic to your https://www.lovesdata.com/blog/ sub-folder, then you can enter /blog/ into the template.
- Hostname – allows you to include (or exclude) traffic based on domain name. For example, if you have your tracking code on https://www.lovesdata.com and https://www.analyticsacademy.com, then you add a filter with the hostname of lovesdata.com to only include traffic for your primary website.
Custom filters provide greater flexibility, allowing you to:
- Exclude data
- Include data
- Change data to lowercase
- Change data to uppercase
- Search and replace
- Create an advanced filter to modify data
Can I apply multiple filters?
Yes, you can create and apply multiple filters inside Google Analytics. However, the order you apply multiple filters to a single reporting view matters. Here’s a simple scenario to explain what happens… Let’s say we only want to include two sub-folders in our reporting view. We want to include the /blog/ and the /courses/ folders. So we create two filters:
Since filters cascade (with the filter at the top applied first), Google Analytics will compare our data against the filter configuration. In this scenario, only data for the /blog/ folder will be allowed through the first filter.
The second filter will then be applied. Since this filter will only allow data for the /courses/ folder through, it means that no data will end up in our reports. We’ll only have zeros.
So filters are applied in cascading order. The data we collect passes through each filter (starting at the top). Continuing our scenario, this means that if we do want to see data for the two folders in our reports, we’ll need to create a single filter that includes all of our criteria.
And here’s the actual filter we’d use:
This also emphasizes my recommendation for a testing view if you’re just getting started with filters. You don’t want to end up with zeros in your primary set of reports.
What are the critical filters I should create?
Here are the most important filters you should consider adding to your reporting views inside Google Analytics:
1. Exclude internal traffic
There are different techniques you can use to exclude your traffic from your reports. However, the most reliable method I’ve found is to exclude internal traffic based on a static IP address. (The other methods out there are prone to mistakes and failure.)
To create this filter, you’ll need to know the IP address (or addresses) that your organization uses to connect to the internet. Then you’ll need to create a new filter, like this pre-defined filter:
OR this custom filter:
2. Lowercase campaign tags
If multiple people are creating campaign tags to monitor the performance of your inbound marketing, then you should consider adding filters to force all of your campaign tags to lowercase.
This will clean up the data in your reports so that you don’t see separate data for Campaign One, Campaign one, and campaign one. Instead, you’ll see combined data for campaign one moving forward.
You’ll need to create additional lowercase filters for ‘Campaign Source’, ‘Campaign Medium’, ‘Campaign Term’ and ‘Campaign Content’.
3. Ensure data accuracy
To help ensure you’re only collecting data from your websites you can create an include filter that specifies your domains.
4. Lowercase page URLs
Sometimes people can view the pages on our website using different capitalization. For example, navigating to the homepage might show the page as /default.aspx or even /Default.aspx. This means that you’ll have two separate rows in the ‘All Pages’ report, even though they’re really the same page.
If you notice something like this happening in your reports (navigate to ‘Behavior’, then ‘Site Content’ and select ‘All Pages’ to check), you should add a lowercase filter to make all of your pages lowercase inside your reports.
Make sure you select ‘Request URI’ this will make everything after your domain name (like /default.aspx) lowercase in your reports.
5. Lowercase site search terms
If you have a search function on your website, then you’ll probably notice that people search using different capitalization. Someone might search for ‘contact us’, while someone else searches for ‘Contact Us’. You can streamline your Site Search reports by adding a lowercase filter to the different search terms people are using on your website.
6. Add domain name to reports
If you’ve added your tracking code to multiple websites (for example, if you’re using cross-domain tracking) then you’ll want to add this filter to your reporting view:
This filter makes it easier to see how your different websites (and their content) are performing. Applying this filter will mean that you see www.lovesdata.com/courses/ in the Site Content reports, instead of just /courses/.
7. Only include a specific domain (or domains)
If you have added your tracking code to multiple websites, then you can also use filters to create individual reporting views for each website. For example, let’s say we’ve added our tracking code to lovesdata.com and analyticsacademy.com. We can create three reporting views:
- One view that contains data for both websites
- One view that only contains data for lovesdata.com
- One view that only contains data for analyticsacademy.com
View filter for both websites:
View filter for lovesdata.com:
View filter for analyticsacademy.com:
8. Search and replace
You can use search and replace filters to clean up a range of data in your reports. For example, you might track form submissions as ‘sub_form_01234’ using events in Google Analytics. You could then use a search and replace filter to replace this with something more readable like ‘Subscribe Form’ in your reports.
Search and replace filters are useful if you have unreadable identifiers or other codes showing up in your reports.
Which filters should I avoid?
Filters have been an important Google Analytics feature for a long time. They were around before custom segments became available to speed up the way we analyze our data. Before segments, we needed to create multiple views for the different types of analysis we wanted to perform.
For example, if we only wanted to see the pages that were viewed by people in Canada, then we needed to create a new view, add a filter that only included our Canadian traffic, and then wait for enough data to be available for our analysis. It was painful.
Segments and table filters mean that we don’t need to use view filters in some cases. For example, you don’t need to create a filtered view that only contains a specific campaign. You can create a segment and apply it to your reports instead. Before creating new filters I recommend asking yourself – ‘Can I use a segment instead of view filter?’.
Here are my top recommendations for filters you should AVOID using in Google Analytics:
- Include or exclude filters based on campaign tags (including source and medium).
- Include or exclude filters based on geographic locations.
- Include or exclude filters for the different devices people are using to view your website (including mobile, tablet or computer).
- I’d also recommend avoiding filters to exclude query parameters unless you know what you’re doing. An easy way to remove query parameters is to add them to your view settings.
As we’ve seen filters are a powerful way to modify the data you include (or exclude) in your reports. Remember that unlike segments, filters permanently modify your data, so I recommend applying new filters to your test view before adding them to your primary reporting view