Using Regular Expressions to Group Keywords in Google Analytics
Earlier this week, SEER held a “Google Analytics 101″ training for our interns. Questions were asked about RegEx, and I ended up sending an email out to the team with my most commonly used Regular Expressions, as used for Keyword Analysis within Google Analytics. Below are the five Regular Expressions shared with the team:
1) | (pipe) – OR. This is the one youll need 98% of the time!!
Looking at SEER’s Google Analytics profile, many of our terms come from people searching for “SEER” or for “Wil.” To see searches that contain either “Wil” or “SEER,” use the pipe: seer|wil Everything that contains either of these two terms will come back.

2) ^ (carat) – Starts with.
^seer finds keywords that start with “seer,” so SEER Interactive would match, but thinkseer would not.

3) $ (dollar sign) – Ends with. This is the opposite of the carat.
interactive$ finds keywords that end with “interactive,” so “SEER Interactive” would match, but “SEER Interactive Philadelphia” would not.

4) ? (question mark) – Last character can be ignored.
There are almost always going to be variations in how people search for your brand name. I see a lot of people searching for us as “SEER Interactive” but others searching for “seerinteractive.” I want to catch both, and the question mark makes that easy. Using seer ?interactive tells GA that we want all instances of “SEER Interactive” with or without the space.

5) + (plus sign) – Last character can be repeated.
Know how many people have searched for Wil as “Will” in the last month? Whether they spell it “Wil” or “Will,” the searcher is still looking for the same person. Using the plus sign can help us here. wil+ will find the person searching properly for “Wil” but will also catch “Will,” or even “Willlll.”

These can be paired up, made into Includes or Excludes, used for advanced filters, and utilized for segments. As an example, if I wanted to look at people searching for “SEER Interactive” or “ThinkSEER,” both with and without spaces, with out any longtail, and with people who accidentally used 1 or 3 “e’s” in SEER, I’d use this: ^se+r ?interactive$|^think ?se+r$
Please note – This post is intended to be basic. There’s a lot more that can be done in GA with RegEx. If you’re looking for additional information (and can’t wait for our next blog post on the subject!), there are some phenomenal comprehensive posts on RegEx. If you already have a favorite RegEx post, please share!
Follow Rachael on Twitter @RachaelGerson
Posted: 02.11.11

Amanda:
Thanks for the helpful tips- I’m always looking for Analytics Hacks… This is becoming especially valuable as we quantify the amount of long-tail keyword traffic SEO is generating by optimizing for the root term. Awesome!
Shane:
It’s wild how little info Google provides on how to do searches like that using RegEx. From a usability standpoint, it appears that all you can do is search by “containing” or “excluding” keywords. Thank you for showing some of the most popular ways to use RegEx in GA!
Hello SEO:
Very interesting post to begin to use Regular Expressions with Google Analytics.
Thank you for sharing your examples and hacks. It’s very powerful!
Rachael Gerson:
Thanks everyone for the positive feedback!
Justin:
THAT’S a useful way of being able to isolate groups of keywords.
BUT it’s still pretty long winded compared to using wordtracker’s Strategizer tool, which groups all your ANALYTICS keywords into niches.
its great for finding the niches that are bringing you most business and for planning seo and link building.
JUSTIN
Rachael Gerson:
Hey Justin, thanks for the feedback! I haven’t tried your Strategizer tool, but will check it out.
Peter O'Neill:
Hi Rachael – those are great examples of how use RegEx to filter on groups of keywords on GA. I wish I had found the post a few hours sooner, would have included a link to it within a new post I wrote on categorising search terms in GA. I realised that you could use the same regular expressions but in profile filters to populate an unused campaign field (like Campaign Name for organic search) with the name of the search term category. Similar to what you have done but I feel it offers a bit more when it comes to analysis. Check it out and would be interested in your thoughts – http://bit.ly/hvxJwE.
Peter
shpyo:
I’ve never user RegExp in GA, so it’s time to start doin’ this :). Thanks for sharing :>
Rachael Gerson:
@Peter Thanks for your feedback! I read your post, as well. I love the idea – Anything that lets you cut data down into more digestible and easily analyzed pieces is a good idea to me! I personally am trying to do as much as possible within segments, vs filters, currently. With the number of different things I was looking into and testing, I quickly ended up with a ton of profiles for each project, which wasn’t sustainable. I’m going to try your setup on one of my personal profiles, though :)
@shpyo No problem, good luck!
Taylor Cimala:
Great resource and well written examples of how to use some of the more intricate areas of regex in analytics. Crossing these with some advanced segments is definitely a great way to dice up traffic and help show value a lot more efficiently to clients.
Joel:
Holy crap. All I can do is shake my head and think back to all the wasted minutes creating 9 filters when one would have done the job. You have my eternal gratitude.
Rachael Gerson:
@Taylor & @Joel – Thank you both! Joel, happy to help. I have a lot of fun playing with RegEx, this is just the tip of the iceberg. If you ever have questions or want to try something new, don’t hesitate to reach out!