Upcoming LunaMetrics Events
Google Analytics and AdWords Training in Boston, July 22nd - July 26th

REGEX TOOL: The Regexinator, A Google Analytics RegEx Include Filter Compiler

If you’ve ever had to string together multiple phrases for a RegEx filter in Google Analytics, you know how much of a pain it can be to assemble. You have to get all the terms, stick them together with pipes, and escape any RegEx characters in the filter. All of this can become very time-consuming, and woe upon you if you have to do this multiple times.

Enter the Regexinator, a Google Analytics regex generator that takes long lists of words or phrases and generates 255 characters snippets of properly formatted RegEx-style terms. Click here and download it now!

Regexinator-download-button

How the Regexinator works

First, download the sheet and open it in Excel. Once you’ve opened it, gather the terms you’d like to create filters with and paste them under Terms in Column A. Then enter either “Y” or “N” in the box next to “Exact Match?” if you wish to only see results that match exactly your terms. Your filters will appear under ‘Results’ in Column E – you’ll only be able to use one cell per include filter, since they’re built to be or get as close to being 255 characters, the maximum number Google Analytics allows for RegEx. Not sure how to use more than one include filter? You just create a new custom segment under the Advanced Segments option on Google Analytics.

Why would I ever need this?

I can think of plenty of hypothetical scenarios that this might come in handy – but let me share mine with you. I needed to find the most profitable product for an ecommerce client of ours in Google Analytics. Unfortunately, even though they all shared a category on their search subdomain, they didn’t share a common feature in their URL that I could filter by. Here’s what I mean:

    • Red Hat 1 (example.com/redhat1)
    • Red Shirt 1 (example.com/holiday/shirts/redshirt1)
    • Blue Pants 1(example.com/pants/bluepants)

Since there was no easy way to filter for all of these products, I simply created a filter using RegEx that looked like this:
Red Hat 1|Red Shirt 1|Blue Pants 1
This worked well enough, but would return a bunch of other irrelevant products that contained similar terms. So then I created them in an exact match format:
^Red Hat 1$|^Red Shirt 1$|^Blue Pants 1$
That got me the information I wanted. Now picture doing this 20-30 times, and you begin to see why an Excel tool that does the heavy lifting for you comes in quite handy.

Is this a solution you’ve been looking for? Let us know in the comments.

Dan Wilkerson

About Dan Wilkerson

Dan Wilkerson is the Marketing Manager at LunaMetrics, with a background in Advertising and PR. Since producing his first commercial at 18, Dan has wanted to get involved with brands. Dan loves solving problems creatively, effectively, and measurably, and has had experience with a wide variety of businesses ranging from tech start-ups to household charities.

http://www.lunametrics.com/blog/2012/12/18/google-analytics-regex-tool/

9 Responses to “REGEX TOOL: The Regexinator, A Google Analytics RegEx Include Filter Compiler”

Sayf says:

Nice work, Dan! I’ll make use of this today! It’s like Christmas has come early. No coal for me. No sir. I have this.

Dan Haggerty says:

Awesome stuff! I’ve been looking for something like this for a while. So awesome that I don’t have to build one on my own now!

James says:

Not sure this is working – I’ve tried over-writing expressions and don’t seem to get out what I’ve put in…

Also aren’t you making the expressions longer than they need to be?

^Red (Hat|Shirt) 1$|^Blue Pants 1$

Hey James,

Yes, they could be shorter – this tool is about brute force, not finesse, hence the redundancies :) . Thus far, I’ve had no problems with the tool or overwriting my expressions, but if you can point to something that hasn’t worked that would be extremely helpful.

Best,
Dan

Angela says:

The link doesn’t seem to be working to download the Regexinator.

Hey Angela,

Not sure why it wasn’t working for you. Tested it last night and again this morning and everything is green. Let me know if you still can’t access it and I’ll send it to you directly.

Best,
Dan

Angela says:

It’s magically working now, thanks!

Mike says:

Hello Dan, this is the kind of filter shortening I’ve been looking for!

I am testing your
^Red Hat 1$|^Red Shirt 1$|^Blue Pants 1$

method, to make sure I’m doing it correctly, would the custom filter be a INCLUDE, REQUEST URI – set up?

how would this work also for the following pages?

/employer/pay_or_play_model.aspx
/health_plan/healthcare_reform_health_plan.aspx
/products/analytics_and_measures.aspx

is this correct or do I need to think of it different? (see code) any help is appreciated!

^pay_or_play 1$|^healthcare_reform_health_plan 1$|^analytics_and_measures 1$

Hey Mike,

That looks like it should work to me. Test it out as an include filter inside the GA GUI and see what pages it shows you – it should just show you any page including those exact phrases in the URI.

Best,
Dan

Leave a Reply