Filters can help refine your data and make it more readable in your reports. For example, you can use a filter to track activity in a specific website directory or track subdomains of your website in separate views.
There are two kinds of filters: “predefined” and “ custom” filters.
Predefined filters have already been created for you in Google Analytics, you just have to select the filter you wish to use. These allow you to include or exclude data based on traffic from the ISP domain, IP addresses, subdirectories, or the hostname, and designate how the filter will match that information.
Custom filters let you include or exclude hits from your data collection, format data to lowercase or uppercase, search and replace data collected in the hit. Custom filters accomplish this by matching a particular filter text-pattern that you identify.
For example, let’s say your business was making a push into mobile and only wanted to analyze mobile traffic in a specific view. You can set up a custom “include-only” filter on the view for Device Category and specify a value of “Mobile.” The filter will look at the criteria specified and match it to any relevant hits that Google Analytics has collected for that view. If the filter can’t match the criteria, the filter will not be applied to that data.
Similarly, you may want to show only data for a specific campaign in a view. You can set up a custom filter to include only campaign data with the campaign name or type parameter you specified. Using view permissions, you can then share this campaign data with partners that you designate.
If there was data you wanted to specifically exclude such as Paid Search (or CPC) traffic, you can set a custom “exclude” filter that will exclude all paid traffic in a particular view, as well.
Lowercase and Uppercase filters
You can also use filters to normalize the data in your reports to make them easier to use. Google Analytics data isn't case sensitive, so pages in the All Pages report may show the same URL multiple times.
You can quickly combine rows that differ only by case, by using a Lowercase or Uppercase filter. These filters will force the case to all lowercase or all uppercase, thus eliminating duplicate data.
This will consolidate that page reporting and make the data in those reports a little neater.
In addition to include, exclude, and lowercase filters, there are other advanced filters that allow you to remove, replace, and combine filter fields in more complex ways using what are called “regular expressions.” Regular expressions (or “reg ex” for short) are characters that you can use to identify matching text in order to trigger an action. A basic regular expression on a filter can be something as simple as a word or a more complicated combination of characters.
Let’s say the Google Merchandise Store wants to set up a view with a filter to see all the keywords users searched for on their website for Android dolls. Because users might search for variations like “Android plush doll,” or “Android stuffed doll,” we can create a regular expression that identifies each of these variations.
We can add an advanced filter with a regular expression that recognizes any Site Search queries that contain the terms “android” and “doll.” This is just a basic example, but you can use regex to find much more sophisticated strings to apply your filters.
For example, if you have technical query parameters passed in the URL of your website, you might have identical pages with different addresses.
Because the URL is different, this page will show up multiple times in your reports. But since they’re the same page, it may make sense to filter out the query parameters, so that it doesn’t appear multiple times in a report.
You can include a regular expression that recognizes the main part of the URL before the query parameter, puts it in a variable, and overwrites the entire URL with that variable. This renders these page URLs identical in reporting.
For businesses that collect data from multiple domains, it can be hard to distinguish page names in Google Analytics. In the “All Pages” report, “googlestoreamerica/index.axd” and “googlestoreeurope/index.axd” will both show up as “index.axd.”
You can use a regular expression to add the hostname in Analytics so that you can distinguish between multiple domains. To learn more about regular expressions, please visit the resources at the end of the lesson.
Remember that filters, like all configuration settings, are not applied retroactively to your data. They are only applied from the moment you create them and can take up to 24 hours before being applied to your data.
Also, don’t forget that the order in which you apply the filters is very important. Each filter passes filtered data to the next filter in the sequence, so you’ll want to be thoughtful about the order in which you apply your filters.
You can adjust the order of your filters by going into “Admin” and selecting “Filters”. Then select “Assign Filter Order.”
Note that you can use filters across multiple views, but be careful. If you edit the filter, those changes will be applied across all the different views to which you’ve applied that filter.
Once you have set up your configuration, Google Analytics processes the data by checking each hit against your filters. If a hit matches the logic in a filter, then that filter will be applied.
Remember to test out your filters in a “test” view before you apply them to the “master” view. Also, be sure to test out your filters on real-time reports to make sure they’re working because they may take several hours to filter all of your data.