The filters field restricts the data returned from Google Analytics. This allows you to get very specific with the data and traffic you want to see.
The basic form of a filter is the Google Analytics tag (ga:) followed by a metric or dimension (example mobileDeviceModel) followed by an operator (equals ==) followed by an expression (example iPhone).
In simplified form it is (Metric/Dimension)(Operator)(Expression)
So the whole filter expression would be:
We will now go through each part of a filter expression and how to use it, as well as give some commonly used examples.
Metric or Dimension
We wrote a brief intro to metrics and dimensions here. Grow provides a list of all the Metrics and Dimensions available in a searchable form.
Dicing Up Your Data: Further Filtering
There are two different kinds of operators: metric operators, and dimension operators. There are a couple that overlap in each category, but depending on what you choose to filter (either a metric or a dimension), it will pull data per the constraints you put on it.
The following shows the metric operators and how they function in a filter.
This one shows you the dimension operators.
The Google documentation has a little more explanation as to how these operators work.
You can enter whatever you want as an expression. However if you enter something that doesn't match anything you will not get back useful data.
One of the best ways to figure out what expression to enter is to display all the possible results from a metric or dimension and then copy and paste one of those.
For example, let's say we are creating an iPhone app, and we wanted to see just traffic from iPhones. We could enter the filter ga:mobileDeviceModel==iPhone and we would get back data.
But is that correct and or complete? Instead let's view all the data using the mobileDeviceModel dimension.
We can see that there is a few models of iPhone, each individually represented.
If we had just used iPhone we would have not seen 1,002 sessions, which is over 50% of the traffic. Instead let's use the contains operator =@ which will capture all the iPhone models. The filter expression ga:mobileDeviceModel=@iPhone gets us much better data and we know it is more accurate.
In Grow, you will see a button labeled Segments below the filter statement field. This button asks for filtering beyond what metrics, dimensions and filter expressions give you. It is not required, but it can be useful. You can filter in or out users with certain criteria. For example you can pull in data from only new users, mobile users or paid traffic.
Here are some examples and commonly used filters. Remember each must be URL encoded.
- Organic Traffic
To filter down to only traffic from organic traffic (not paid) the filter expression is:
- Traffic only on a specific page
Let's say you want to see how much traffic a new landing page or blog article is getting. And let's go one step further and you only want to see organic traffic to a specific page.
ga:medium==organic;ga:pageTitle==Grow | Features
You could use the page title, or you could use the page URL or pagePath. Add the pagePath dimension, copy the path, and then use the filter expression
- How to track iPhone sessions
A common report people want to see is mobile traffic. In Google Analytics web app, it looks like this.
We can pull the exact same report into Grow by selecting sessions as the metric, and mobileDeviceModel as the dimension.
Notice how the numbers match up exactly. If you are finding a difference between your metrics in Google Analytics and Grow, check the date range, and see if you are filtering anything on the GA side.
- Advanced Filtering Examples
Country is United States AND the browser is Firefox:
Country is United States AND language does not start with 'en':
Operating system is (Windows OR Macintosh) AND browser is (Firefox OR Chrome):
Country is United States AND sessions are greater than 5:
- Filter by event label
You can filter by pretty much anything in Grow including event labels. For example if your event label is 'I AM AWESOME' then inside Grow it looks like ga:eventlabel=@I AM AWESOME
If you have any questions please email email@example.com or chat in on the site.