In this lesson we will cover the basics of filters
including some common filters that can help improve the quality of your reports.
Filters provide a flexible way of modifying the data within each view.
You can use them to exclude data,
include data,
or actually change how the data looks in your reports.
Filters help you transform the data
so it's better aligned with your business needs.
During processing, Google Analytics applies your filters
to the raw data collected from your website or app.
This transformed data is what you see in the reports for each view.
Let's look at an example.
From a business perspective you probably only want to analyze data
from your customers and potential customers.
You don't want data from your employees mixed in with data from your customers.
You can use a filter
to exclude traffic from your internal employees.
The easiest way to do this is to create a filter
that excludes all of the data from the IP address for your business.
As Google Analytics processes your data
it will ignore any data coming from that IP address.
You can also use a filter to clean up your data.
For example, sometimes a website will show the same page
regardless of the case of the URL
-- uppercase, lowercase or mixed case.
Since Google Analytics treats data as case-sensitive,
this can result in the same page showing up multiple times, based on case, in your reports.
To prevent this separation and see the page data in aggregate,
you can set up a lowercase filter to force all of the URLs to a single case.
Now let's dig a bit deeper into the details of setting up filters.
Filters are instructions to Google Analytics to transform the data within a view.
We call these rules "conditions."
If the condition is true, then Google Analytics will take some type of action.
If the condition is false Google Analytics won't do anything.
First, you need to identify the type of data you want to evaluate or change.
You do this by selecting the Filter Field.
Some common fields include User IP address, Device type or Geographic location.
Next, you specify the condition, or set of rules for the filter.
During processing, when Google Analytics finds the field,
it applies the condition.
There are many types of conditions.
Common ones include "matches a certain pattern," or "does not match a certain pattern."
For example, if you are using a country filter, your condition could be "matches United States."
Finally, you choose the action that Google Analytics takes if the condition is true.
You can select to include the data that meets the condition, exclude it,
or change it from its raw form into some new and more useful.
Remember, filters, like all configuration settings, are not applied retroactively to
your data.
They are only applied from the moment you create them.
To help simplify filter setup, we've divided filters into two categories:
Predefined Filters and Custom filters.
Predefined filters are templates for some of the most common filters.
Custom filters let you truly customize filters to fit almost any unique situation.
Let's go back to the examples in this lesson to see how you set up a filter field, condition,
and action.
We'll start with excluding internal traffic from your company.
To set up this filter, you'd select "Predefined filter."
For the filter field, you'd select "traffic from the IP addresses,"
and enter an IP address from your company that you want to exclude.
Select the condition "that are equal to."
Or, if you need to exclude a range of IP addresses, you might select "that begin with."
Then, for the action, select "Exclude."
Once you've saved this filter and applied it to a view,
Google Analytics starts checking the IP addresses of traffic to the web property.
Any traffic data from the IPs that you've excluded in the filter
will be thrown out of the views to which the filter has been applied.
To add a filter that forces all the URLs to lowercase, you can use a custom Lowercase
filter.
First, choose the custom filter type,
then choose the Lowercase filter option.
Next, tell Google Analytics which filter field should be transformed to lowercase.
That's it!
For this particular type of filter, the condition and action are both implied
and don't need to be set up.
There are many other types of predefined and customized filters that you can use in Google
Analytics.
In addition to exclude filters and lowercase filters,
there are "include" filters,
"uppercase" filters
and other advanced filters that allow you to remove, replace, and combine filter fields
in more complex ways.
It's very common to apply multiple filters to the same view.
But keep in mind that filters are applied in the order that they appear in your configuration
settings.
Filter order matters, because the output from one filter becomes the input for the next
filter.
Let's say you want to modify the data in a view to only include data from the United
States and Canada.
Your first reaction might be to create two Custom include filters.
One filter to include traffic from the United States and one to include traffic from Canada.
Actually, this won't work, and here's why.
During data processing, Google Analytics will apply the filters in the order that you set
them.
If the first filter is set to only include United States traffic,
the data that is output from that filter will not contain any data from Canada.
The solution is to instead create a single include filter that will include data from
United States OR Canada.
Once you create a filter it's added to the Filter Library for your whole account.
This means that you can reuse filters you've already created and apply them to any view.
Remember, you should always try any new filter on your test view first.
This helps ensure that you understand the result of your filter before applying it to
your master data view.
The filters you choose to implement will depend on your specific measurement objectives,
so it's important to plan first before you start setting up your filters.
Now it's your turn to practice creating filters.
Complete the activity below to apply what you've learned in this lesson.