Google Analytics does not automatically apply uniformity of data, making it difficult to parse and analyze information about your web properties. Thankfully, Google Analytics offers us a solution in the form of filters. Filters can be used for any number of reasons, such as excluding or including internal traffic, searching a field for a particular string and replacing the data with another string, breaking a field or fields apart while creating a new field from this data, and converting a text field to uppercase or lowercase.
Consider the following example of data collected within Google Analytics without any filters in place:
All four of the above URLs point to the same page in your website, but Google Analytics will look at them as four unique pages. If you wanted to know how many visitors actually viewed your home page you would have to locate and combine every possible combination and add the totals together.
This blog will outline how to convert a field to uppercase or lowercase and combine two fields into a new field.
Before You Start
Filters can have unexpected consequences and need to be tested first. If you create a filter in the administrator’s area you will be affecting data as it enters Google Analytics before it gets stored. If you exclude data incorrectly without testing, that data will not be captured by Google Analytics, and cannot be recovered.
For this reason, as you begin working with filters, we recommend setting up the following three views.
- Raw Unfiltered View – This view should never have any filters applied to it. It allows for the preservation of raw data. If anything unexpected happens to your “Main View” data in this view can be used as a backup.
- Main View – This view is your reporting view and would contain any filters that performed as expected during your testing period in your Test View. Only apply a filter to this view once you have tested it and are confident it is functioning as expected.
- Test View – This view is where you would apply all your filters first to verify that they perform as expected. All filters would be applied here and allowed to run for a few days. If everything looks good after a few days, then the filter can be applied to your Main View.
Filters only work on new data and not on historical data already captured in Google Analytics. In addition, as you test, think about the order in which you apply filters. They are executed in the order they are applied. Think of them as series of screens that get smaller, as each additional filter can only work off the data left over from the previous filter.
How to Create Filters
To access filters, sign in to Google Analytics and click “Admin.” Filters can be created at either the “Account” or “View” level. Remember, we want to create them at the “Account” level, as this will ensure that the filters are available across all properties and all views. Select “All Filters” located under the “Account” level, and then select “Add Filter”.
The first filter we want to create is a filter that will correct the examples above and make all future URLs captured by Google Analytics uniform.
A second useful filter is to make your visitors’ search terms that are captured by Google Analytics uniform.
A third filter to consider is to show your full domain. At first glance you might think these are the same page.
But in reality, if you happen to be using cross domain tracking, they could be entirely different websites:
The filter below will help clear up any confusion by displaying the full domain and path.
Finally, you can use filters to make a media campaign uniform so that the data is easier to understand, sort, and read. These filters would force the various aspects of campaigns to be captured in lower case.
- Campaign Medium
- Campaign Source
- Campaign Name
- Campaign Term
- Campaign Content
Limited only by your imagination, filters can be a powerful tool inside of Google Analytics. Looking for help implementing filters properly in Google Analytics, or applying them by device or geolocation? Contact us at firstname.lastname@example.org.