Advanced Filters With Fields Required/Not Required

July 7, 2008 | Jonathan Weber

On a post way back in April on Custom Advanced Filters, Idris left a comment asking about the required/not required selection (seconded by Paul):

Hey, great articles. I am trying to do some advanced filtering, but I’m confused by the “Field X Required” option. If I say “Yes” to the requirement, which of the following two things does that mean?

a. If the regex in this field does not match, do not include this hit in the profile at all.

b. If the regex in this field does not match, skip this filter, and move on to the next, but still include these hits in the profile.

These two are obviously very different. Which does Google Analytics do?

The confusion is about what exactly is “required”. We were pretty sure we knew, but we did an experiment to confirm. It’s basically b from what Idris suggested.

Here are the details:

  1. If the field is required and the regex matches, the output is written to the field you select.
  2. If the field is required and the regex does not match, the output is not written to the field you select.
  3. If the field is not required, the output is written to the field you select regardless of whether the regex matches.

In no case are the pageviews excluded from the profile entirely (you need an exclude filter for that). The filter just doesn’t apply if the field is required and it doesn’t match.