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.

Our founder, Robbin Steif, started LunaMetrics in 2004. She is a graduate of Harvard College and the Harvard Business School, and has served on the Board of Directors for the Digital Analytics Association. Robbin is a winner of a BusinessWomen First award, as well as a Diamond Award for business leadership. In 2017, Robbin sold her company to HS2 Solutions and has since retired from LunaMetrics.

  • 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
    Filter Field: Referral
    Filter Pattern:||||….

    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,


  • Pingback: Bloglinks der Woche (KW 41) | Webanalyse & SEO - News()

  • Pingback: Bloglinks der Woche (KW 41) | Webanalyse & SEO - News()

  • david knott

    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 – go read the second part, here
    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.

  • colorado_gumi

    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?

  • colorado_gumi

    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.

  • colorado_gumi

    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.

Contact Us.

Follow Us



We'll get back to you
in ONE business day.
Our Locations
THE FOUNDRY [map] LunaMetrics

24 S. 18th Street
Suite 100

Pittsburgh, PA 15203


4115 N. Ravenswood
Suite 101
Chicago, IL 60613


2100 Manchester Rd.
Building C, Suite 1750
Wheaton, IL 60187