Include vs Exclude GA Filters: Part 3e
I spoke about implementation Google Analytics on Friday, and someone asked me, “How do I create Exclude AND filters?” This is a cool question, but it has to wait until I write the info below on how Google applies your filters (and how that differs on Include vs Exclude filters.) Note: you can read the GA documentation on this one, which is not terrible.
You might consider include multiple filters to be AND filters, when you think about the way that GA applies all of them to a profile. So if you create a profile where an include filter specifies Visitor City = Pittsburgh, and the another include filter specifies Campaign Source = organic, you will filter in only visits that came from people in Pittsburgh who used the organic search to find you. It’s not good enough that they came from Pittsburgh and used paid search, or followed a link. Both criteria must be met.
Exclude filters, on the other hand, could be looked at as OR filters. If the visit matches any of the exclude filters in a single profile, it is thrown away. So using the same example as above, Visitor City = Pittsburgh, and the Campaign Source = organic, you will exclude anyone who comes from Pittsburgh, no matter what their campaign source. And you will exclude everyone who comes on an organic search, no matter what their city.
There are ways around the AND and OR issues. For example, let’s say that I wanted to include everyone from Pittsburgh OR Raleigh. I cannot do it with two separate city filters — right? Include filters are AND filters, so two separate filters would say: include everyone who comes from both Pittsburgh AND Raleigh, which is a pretty hard act. But you certainly could do include visitor city = (pittsburgh)|(raleigh). By putting both cities in the same filter with an OR pipe, you achieve that goal.
Now that I showed you how to defeat the “ANDness” of Include filters, you will be wanting to know, how to do defeat the “ORnesss” of Exclude filters. Plus, you might want to know how to make include filters be OR filters for different kinds of fields — include if they came from Pittsburgh OR they came organically.
But that is a different topic and a new post. Maybe even tomorrow.
Related posts:


October 11th, 2007 at 6:02 pm
This is great content, thanks for getting in more detail for these filters. I am having a hard time setting up an include filter for 25+ sites that are affiliated with us. Could you possibly put together a post for this? Here is what I have thus far:
Custom Filter
Include
Filter Field: Referral
Filter Pattern: 29thanimalhospital\.com|43aah\.com|animalmedics\.com|a\-paw\.com|….
I am not sure if this is correct, as I just set it up a few days ago? Is it possible to set up an include filter for this many sites?
Thanks for the great posts,
BJ
October 14th, 2007 at 2:32 pm
[...] Include vs. Excluse GA Filters (Lunametrics) [...]
November 6th, 2007 at 4:57 pm
thanks for the clarification.
however, i have a question about the filter pattern for cities (specifically in an exclude).
how do you list a city whose name is not nationally unique, e.g. Lexington? i’ve tried Lexington, Va as an include but received no visits.
i’m guessing there might be a combination of include and excludes (one being the state the other the city), however, for whatever reasons i lack the logic to solve this question.
thanks in advance,
david
November 6th, 2007 at 5:35 pm
David – go read the second part, here http://www.lunametrics.com/blog/2007/10/21/filters-for-ga-part-5-now-lets-practice/
this is a perfect example. You need to create a filter that excludes city=Lexington and Region=VA. So you rewrite those two fields to be concatenated in Custom1 (maybe the rewrite looks like $a1/$b1) and then your next filter is an exclude when the pattern of custom1 is lexington/va
But you need to look at that other post, and I need to thread this so that it is easier for people to do that.
November 21st, 2007 at 4:14 pm
My question is the same as David’s above …non-unique city name, like Lexington… and the suggested solution from Robbin seems appropriate BUT when creating a “Custom filter” with the “Advanced” option in accordance with the example cited, the drop down list does not include the visitor’s geographic city and region as options to select.
The necessary combined field for the filter we want apparently cannot be created with the selection of fields provided?
November 29th, 2007 at 9:59 am
My question above was answered in a discussion at a different post…
The solution suggested by Robbin would work for me, and probably for David, BUT the variables needed (visitor city and visitor region) don’t show in the drop down menu if working from the Firefox browser for some reason.
So do the work using Internet Explorer, which will show ALL the available variables in the drop down menu, or with Firefox, cycle through the variable choices in the box using the up ‘n down arrows rather than the drop down menu.
December 4th, 2007 at 9:11 am
Everything I said on 11/29 is correct BUT the “missing” variables don’t “stick” in the filters using either Firefox or IE, and filters created with them are useless. Apparently there is more of a problem with those “missing” variables than just getting them to show up in Firefox. Once that problem is fixed, Robbin’s suggested technique should work fine.