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.
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.
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.
“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!