Three Reasons To Use Regular Expressions in Google Analytics

Three Reasons To Use Regular Expressions in Google Analytics

A regular expression (affectionately called "RegEx") is a string that many of us Google Analytics geeks use to describe or match a set of strings based on certain syntax rules. Google Analytics (GA) supports regular expressions so that users can create more powerful implementations.  In this article I am going to discuss the three main usages of RegEx in Google Analytics.

RegEx in Google Analytics

1. Creating Filters In Google Analytics

Filters in GA are more advanced and is useful for getting some very refined reports. One of the most used filter application in GA is excluding IP addresses.  This allows us to strip out the internal traffic from the GA report. Individual IP's can be excluded with predefined filters. By using custom filters we can block a range of dynamic IPs . This can be done by defining a proper RegEx format to get the entire IP series blocked.

Are you not a RegEx geek? Not sure about the expressions of quantifiers & repetitions? No worries. Google has a tool to automatically generate the correct regular expression for your range of IP addresses.

How will you make sure that you filtered out all internal IPs? Recently our very own GA wizard Jon has written a post on this titled “making sure specified RegEx format filters all internal IPs”.

2. Setting up Goals in Google Analytics

Goal set up is used to measure the number of conversions that a website is getting.  Most conversions we use help us understand how many form leads are being received.  To do this we need to choose a goal page which loads after the visitor completes the desired action. You may need to track many actions under one goal setup which have different goal pages. If that is the case the goal page should be defined in regular expression format so that Google Analytics will register goals when users complete all the desired actions which you want to be completed.

For example, the following are the pages that come after the desired actions.

/offer/signup.html
/offer1/signup.html
/offer2/signup.html
Exact regular expression will match all the above three goal pages is “/.*/signup\.html” or “signup\.html$”

3. Filtering Data Within The Report Interface

Most Internet marketers love getting the Google Analytics keyword report to see the search terms that visitors used to reach the website. While reporting to this client, we at TechWyse like to filter out brand name searches in the keyword report.

filter-keywords
This regular expression (tech\s?wyse) matches the following terms and strips them out from report.

“techwyse, techwyse.com, tech wyse”. This is an example and can be used in any Google Analytics report.

And so this ends my session on using regular expressions in Google Analytics.  I hope it helps!

It's a competitive market. Contact us to learn how you can stand out from the crowd.

Read Similar Blogs

Post a Comment

2 Comments

  • avatar

    Well it is a good to know that GA is not just a few random bars or line graphs and some heavy number crunching to do, but also helps get you specific and useful information and using filters extensively to drive your point in there. I think its a good way to start experimenting your results and carve the right results! 🙂

  • avatar

    Good read Elan! I didn't think RegEx can do this much to filter and get proper analytics data. It seems Google is using RegEx extensively in all the areas. Moreover it's good that we've got tools to generate RegEx and no coding knowledge is required to keep going.

Ready To Rule The First Page of Google?

Contact us for an exclusive 20-minute assessment & strategy discussion. Fill out the form, and we will get back to you right away!

What Our Clients Have To Say

L
Luciano Zeppieri
S
Sharon Tierney
S
Sheena Owen
A
Andrea Bodi - Lab Works
D
Dr. Philip Solomon MD