[UA] Advanced filters [Legacy]

You are viewing a legacy article about Universal Analytics. Learn more about Google Analytics 4 replacing Universal Analytics.

The Advanced filter lets you construct Fields for reporting from one or two existing Fields. Use POSIX regular expressions and corresponding variables to capture all or parts of Fields and combine the result in any order you wish. For general information on how filtering works, read About Filters.

An Advanced Filter takes up to two fields, Field A and Field B, to construct the Output Field. The Extract A expression is applied to Field A, and the Extract B expression is applied to Field B. These expressions can use complete or partial text matches and include wildcards. The following is a list of the most common wildcards and their meanings. The expressions conform to POSIX regular expressions.

Wildcard Meaning
. match any single character
* match zero or more of the previous item
+ match one or more of the previous item
? match zero or one of the previous item
() remember contents of parenthesis as item
[] match one item in this list
- create a range in a list
| or
^ match to the beginning of the field
$ match to the end of the field
\ escape any of the above

Use the parenthesis () to capture parts of the Fields. These can be referenced in the Constructor using the $A1, $A2, $B1, $B2 notation. The $A or $B refers to the Field, and the number refers to which parenthesis to grab. In the above example, the entire Field A and the entire Field B are captured and assembled as the new field. The Output to Field can be a separate field or the same field as Field A or Field B.

Controls

The Override Output Field option lets you decide what to do if the Output to Field already exists. The Field x Required option lets you decide what to do if one of the expressions does not match. Finally, Case Sensitive indicates whether the data must match the strings with exact capitalization.

Was this helpful?

How can we improve it?
true
Choose your own learning path

Check out google.com/analytics/learn, a new resource to help you get the most out of Google Analytics 4. The new website includes videos, articles, and guided flows, and provides links to the Google Analytics Discord, Blog, YouTube channel, and GitHub repository.

Start learning today!

Search
Clear search
Close search
Google apps
Main menu
17637063960947212787
true
Search Help Center
true
true
true
true
true
69256
false
false