Filters for GA, Part 5: Now let's practice/
October 21, 2007
I have been working on this series, Filters for Google Analytics, for almost six months now. This is the last part of the series I am going to write (at least in the foreseeable future.) You can get the full thread at the bottom of this post.
So once again, I will start with the question a lady asked me on Friday morning: how does one create exclude filters that function as if they were AND filters? How, she asked, can I create a profile and put on it two different exclude filters that work together: Exclude the visit if the visitor is a new visitor AND her language is German? We can’t do that with two separate exclude filters, because as soon as the first filter works, the visit gets thrown out. Exclude filters are, by nature, “or” filters.
(If you are a little lost, and don’t remember how multiple exclude filters work like OR filters and multiple include filters working like AND filters, and how you have to work to make them do the opposite — see this post that I wrote recently.)
Well, I had to think about this one, and then realized that it was just a great practice for this series on filters for GA. The reason why: It is both a rewrite (custom advanced filters) and an exclude (custom filter). Here is the overview: you rewrite the two fields into one field, and then you do an exclude on that one field, making sure that it matches both pieces of data.
If that was clear as mud, or you are more of a step-by-step “please show me” person (like I am) — then this is a good place to keep reading.
First, you use a custom advanced filter to rewrite the data so both pieces of info — the visitor language and visitor type, which is GA-Speak for “new” vs “returning” visitor — are in the same field. Like this:
Now we have both pieces of data in the same field. If we could look at them, they would look like this, concatenated together on the same line.
1. en-us/New Visitor
2. de/Returning Visitor
3. da/New Visitor
and so on. They would be the language code followed by a slash and the visitor type. (Right? That’s the way I set it up, $A1 captures everything in visitor language settings, then a slash, then $B1 captures everything in Visitor Type.) Above, I choose three languages for my examples: English-US (en-us), German (that’s de) and Danish (da).
Next, we create an exclude filter. The hypothetical example was to exclude a new visitor whose language is German – the two excludes that must work together. This is the heart of our problem, exclude two different kinds of variables. So here is our exclude:
So what does this say? It say, go to Custom Field 1, where we now have a list of concatenated languages and visitors types (en/Returning Visitor, and so forth). If one of those lines in the list matches de (which stands for German – Deutch, right?) and has a slash and then the word new, it’s a match, so please exclude it.
And that’s how you can exclude two different fields in Google Analytics at the same time.
If you would like to read all the other posts in this series:
- Part 1: Get ready with profiles and ReGex
- Part 2a: Filters for GA, What have we here?
- Part 2b: Why does anyone use filters?
- Part 3a: Easy Filter Implementation
- Part 3b: Custom Implementation
- Part 3c: How do you filter those utm links you create?
- Part 3d: When do you use them?
- Part 3e: Include vs Exclude filters, how do they work?
- Part 4a: Custom Advanced Filters
- Part 4b: More on Custom Advanced Filters
- Part 4c: Cascading Custom Advanced Filters