Getting More than One Requirement out of your GA Report Filter


The Problem

Do you sometimes want a second report filter at the bottom of your keyword reports?

Report Filter

I do. Every time I want to see phrases containing a particular word, but not containing branded keywords. For example, I might want to see all searches containing “conversion”, but not “lunametrics conversion.” It is a recurring theme for me.


The Solution

So what do you do? It’s called a Lookahead, and it comes in two versions. Positive Lookahead and Negative Lookahead. And we can chain together as many as we want.

Let’s say I want to find all keyword phrases that contain conversion and contain website but do not contain lunametrics. Here is what I’d type into the report filter:

^ (?=.*conversion)(?=.*website) (?!.*lunametrics).*$

The (?! begins a negative lookahead (must not match) and a (?= begins a positive lookahead (must match). The regular expressions inside the lookaheads can be as complex as you want. But if you just want to follow the formula I used here. . .


The Recipe

1. Start with ^
2. Place each word you don’t want inside a Negative Lookahead : (?!.*word)
3. Place each word you do want inside a Positive Lookahead: (?=.*word)
4. Chain together as many of each as you want
5. Finish up with .*$


This example will match anything with “website” in it anywhere. If you want to match exactly “website” and not “websites” or “123website”, use (?=.*bwebsiteb) instead.

John is a former LunaMetrician and contributor to our blog.

  • Robbin,

    this post is the most precious/*actionable* piece of information I have read since I don’t remember when. This is just great! My boss asked this exact same question last week and I said this is not possible using GA (he will probably read this comment very soon).

    Thank you for all the insightful posts you have been sharing. They are really insightful, but this one has trespassed the + 4 standard deviations 🙂

  • Daniel – I don’t get any credit. Well ok, I get a little bit. For the new year, I took our whole staff out and said, “Let’s toast to me, because I was smart enough to hire you. ”

    This was written by John Henson. He is a senior web analyst here at LunaMetrics, and I will remind him to put his name on his posts.

  • Brilliant! I think I could spend a whole lifetime and never fully understand regular expressions. Thanks

  • Very many thanks for this info. I couldn’t get it to work at first because I left a space after ^.

    Also, looks like we could expand this easily to include searches for say “adam” OR “eve” by using the pipe operator, eg ^(?=.*adam|eve).*$, right?

  • But how could the search be refined to an exact keyword match as opposed to broad match?

  • Eamonn,

    ^(?=.*(adam|eve)).*$ I think this would be correct for what you want. So if you wanted everything that had “garden” “serpent” and either “adam” or “eve” then ^(?=.*(adam|eve))(?=.*garden)(?=serpent).*$

    For anywhere you want an exact match, use (?=.*beveb) this would match “eve” but not “evening” and not “eve1” (it would also match “+eve+”) As long as the letters “eve” are not surrounded by letters or numbers


  • Thanks John,

    (?=.*beveb) matches “eve” but I would get results like “adam and eve”

    I’m trying to find the code such that only [eve] is returned. (an exact match with no other terms)

  • Eamonn,

    ^eve$ should give you what you want.

  • Aaron King


    Your last two posts have inspired me to move your blog up significantly in relevance when it comes to my RSS reader.

    Great work dude!


  • Pingback: User First Web » links for 2008-01-28()

  • Oh, this one is a real beauty. Of course now with custom segments we can also do this from other directions – but still…fantastic.

  • has anyone tried this recently? I don’t think it’s supported anymore.

  • John

    Lookaheads are not usable anymore with the in-line filter boxes.

    But there is now an option for “Advanced Filter” that you can use to create a filter with multiple conditions.

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