Google Analytics – Save time with Regular Expressions

Using the Content section in Google Analytics

Google Analytics makes gathering data for individual pages rather simple. Simply click the Content link on the right navigation, then click Top Content. You’ll be treated to all of your site’s pages, in descending order of the traffic they receive.

Google Analytics Top Content
Google Analytics Top Content - Great for comparing your top page metrics

This is great if you simply want to know how your top pages are doing.
But what if you need to find specific pages, and these pages aren’t among the most visited pages? In the example above, there are 9,512 pages to sift through. Not many of us have that kind of time or patience.

Regular expressions give you new options

Fortunately, Google Analytics provides a filter which allows you to filter for (or against) values. So in the example below, if we wanted to filter for all of the pages in the /Lift-Kits-Suspensions-Shocks/ directory, we could simply enter that value into the filter field, and Analytics will display every page with that value in its URL.

Google Analytics Top Content Filter
Google Analytics allows you to filter for or against values

This scenario is perfect if:

1- You need to know the overall metrics for the entire Lift Kit section (on this website, the lift kit section exists in the /Lift-Kits-Suspensions-Shocks/ directory ).

2- You only need metrics for a single page, and it can easily be found in the result set above.

But what if you have to report metrics for only a handful of pages? And what if these pages don’t have enough in common to be easily filtered for?

Thankfully, Google Analytics allows you to use regular expressions, which allows for far more advanced filtering. So let’s say you need to report metrics for the following 2 pages.

Lift kits page
http://www.4wheelparts.com/Lift-Kits-Suspensions-Shocks/Lift-Kits.aspx?t_c=1&t_s=38

Lift Kit-Suspension w/Shock
http://www.4wheelparts.com/Lift-Kits-Suspensions-Shocks/Lift-Kit-Suspension-w-Shock.aspx?t_c=1&t_s=38&t_pt=5491

We can filter for: /Lift-Kits-Suspensions-Shocks/Lift-Kit

And get the following result set

Some pages have URLs that can2t be eahsily filtered for
Some pages have URL's that can't be easily filtered for

Getting even more specific

This is still too many results for what we need. We only need to 2 specific results.

How do we do this?

Using regular expressions in your filter allows you to filter for their similarities, while entering their differences as variables.

So we enter this:
Lift-Kits-Suspensions-Shocks/(Lift-Kits.aspx|Lift-Kit-Suspension-w-Shock)

And get this:

Regular Expressions can be used for deeper data segregation
Regular Expressions can be used for deeper data segregation

Now you can pull metrics for both pages. This is especially useful when you want to compare data for 2 or more pages.

A quick explanation on how this works:

We enter: Lift-Kits-Suspensions-Shocks/

Because both pages have those characters in their URL.

We enter: (Lift-Kits.aspx|Lift-Kit-Suspension-w-Shock)

Because this is what makes these pages unique from the other pages we don’t want data for.

Make sure the unique values are separated by pipes and enclosed in parenthesis.

Ummm yeaaahhh….

This will keep Lumberg off your back, and make life much more bearable.

Ummm....yeahhhh...
Ummm....yeahhhh...

1 thought on “Google Analytics – Save time with Regular Expressions”

Leave a Comment