Google Analytics provides a lot of data. While having an overall portrait is necessary, sometimes, you might want to look at more specific pieces of information. This is when filters come in handy.
Filters allow you to refine the data shown in your widgets according to your needs. For example, you can filter your page impressions according to the country in which they occurred or device on which they occurred. You can use filters on both metrics and dimensions.
- 1 – Syntax
- 2 – Filters for dimensions
- 3 – Filters for metrics
- 4 – Combination
- 5 – Multi-channel funnels
- 6 – In DashThis
1 – Syntax
First, you need to know how to write a filter. Filters in Google Analytics require a specific syntax, which looks likes this:
ga:country==Canada
If we replace each of the variables with their official terms, it looks like this:
nameoperatorexpression
Name: This is the name of the dimension or metric you want to apply a filter to. For example, ga:pageviews will apply to the metric called “pageviews”. To know the exact name you need to write, please refer to the Google Analytics documentation. Filters are case-sensitive, so be sure that your capital letters are in the right place!
Operator: This is the formula that will be applied, such as: equal to, greater than, less than, etc. Take a look at the Filters for Dimensions and Filters for Metrics sections below to see which operators you can use in each case.
Expression: This is the value to which the operator applies in order to either include or exclude data.
In our previous example ga:country==Canada
If you want to check out our quick cheat-sheet, we made ourselves a Google Analytics Filter Tool that you can use to get your filter syntax just right.
* This is a beta tool, and at the moment, everyone can access the same sheet. If you notice that there are already several people in the sheet, just wait your turn before starting to edit the fields (or else, everyone will be editing at the same time and no one will get his/her right filter)!
2 – Filters for dimensions
There are six operators you can use in order to filter dimensions.
2.1 – Substring and regular expression
Substring? Regular expression? If you’re not familiar with coding and computer science, these terms might not mean much to you.
A substring is a sequence of characters contained in a longer sequence of characters; “Dash” is a substring of “DashThis” for example.
A regular expression (called RegEx) is a formula that defines a pattern. It’s more flexible and can offer many possibilities.
Regular expressions have multiple functions and can easily become complex. In the context of writing a Google Analytics filter, you probably won’t need to dive too deeply into formulas and endless options.
However, if you want to learn more on regular expressions and unleash their power, we suggest you explore the guide to regular expressions in Google Analytics. You will find an overview of the different symbols you can use and their functions, as well as other tips and tricks.
3 – Filters for metrics
There are six operators you can use in order to filter metrics.
4 – Combination
It’s possible to combine filters to personalize the query even more. You can combine them either with an AND or an OR.
The OR operator is the comma ( , ) : ga:country==canada,ga:country==australia means the query will return results that are either Canada OR Australia.
The AND operator is the semicolon ( ; ) : ga:country==canada;ga:deviceCategory==Mobile means the query will return results that are related to Canada AND mobile devices.
5 – Multi-channel funnels
If you want to apply a filter on multi-channel funnel metrics, the filter syntax is going to change a little bit. Instead of beginning with ga, the filter has to start with mcf. The result would look like this: mcf:source==facebook. Please refer to Google Analytics documentation on multi-channel funnels to know how to write the name in your filter.
How do you know if the metric you want to choose is a multi-channel funnel metric? Easy!
When you create a widget in your dashboard, choose the option Custom widgets, located on the top-left side of the screen. Choose the type of widget you want and Google Analytics as your data source. A drop-down menu called Metric is there, at the very top of the panel. The metrics are categorized under different sections, and one of them is called Multi-channel funnels. They’re all there!
6 – In DashThis
You’re now mastering the art of Google Analytics filters. Congratulations!
It’s time to apply them to your DashThis widgets and get the information that specifically matters to you.
6.1 – New widgets
In the Editor mode, click on the Custom widgets option. Choose the type of widget you want to create as well as the metric and the dimension, if applicable. There is a field called Filter, which is where you’ll write your filter!
6.2 – Existing widgets
You can also apply filters to already existing widgets.
Hover over the widget, and click on Edit widget, located on the right side of the widget. The panel Edit widget appears. Under the section Basics, there is a field called Filter. Make the magic happen, and then click Save.
If you want to check out our quick cheat-sheet, we made ourselves a Google Analytics Filter Tool that you can use to get your filter syntax just right.
* This is a beta tool, and at the moment, everyone can access the same one. If you notice several people are already in the document, just wait your turn before starting to edit the fields (or else, everyone will be editing at the same time and no one will get his/her right filter)!
You now have the info you need in your widget!