Filter examples


Include only United States, Canada, or Mexico

Suppose you want to limit a chart's information to just data coming from the United States, Mexico, or Canada. Select the chart and add the following filter:

  1. Include/Exclude: Include
  2. Dimension: Country
  3. Match Type: IN
  4. Value: United States, Canada, Mexico

Example filter: Country IN United States, Canada, Mexico.

You could also do this using 3 OR clauses. But it's easier to use IN with a list.

Exclude "(not set)"

To exclude "(not set)" values from your charts, use an Exclude filter. For example:

  1. Include/Exclude: Exclude
  2. Dimension: Campaign
  3. Match Type: Equals
  4. Value: (not set)

Example filter: Exclude "(not set)" from Campaign.

Find data at the end of a value

The RegExp Match and RegExp Contains operators let you perform more complex matches. For example, to filter data that contains a value at the end of the data, you can use the end-of-line marker $:

  1. Include/Exclude: Include
  2. Dimension: Medium
  3. Match Type:: RegExp Match
  4. Value: .*c$

Example filter: RegExp Match.

When applied to the Analytics Medium dimension, you'd include values like "organic" and "cpc."

Understanding the regular expression: .*c$

.* means "match anything" (including nothing),

then the literal letter "c"

$ means the "end of line" character. (To match the beginning of the string, use ^.)

Here's another example:

^c.*k.*$ matches text that begins with the letter c, followed by anything , followed by the letter k, followed by anything until the end of the string. This would match values like "cook", "cookie" and "cake".


Exclude data that doesn't begin with an alphabetic character

Regular expression character classes are a powerful shortcut for matching types characters. For example:

  1. Include/Exclude: Exclude
  2. Match Type:: RegExp Match
  3. Value: ^[[:^alpha:]].*

Example filter: exclude non-alphabetic characters.

This will filter out non-alphabetic characters, such as Japanese kanji or Korean Hangul.

Understanding the regular expression: ^[[:^alpha:]].*

^ means "beginning of string"

[[:alpha:]] is the alphabetic [A-Za-z] character class. [[:^alpha:]] negates the class ("not alphabetic")

.* means "match anything"

Google RE2 regular expression syntax.

Was this helpful?
How can we improve it?

Need more help?

Sign in for additional support options to quickly solve your issue