Using Google Analytics without taking advantage of regular expressions is a bit like listening to a VHS tape on an HD television; it works but it does not allow you to take full advantage of the tool.
First of all, what is a regular expression? In its most primitive form, it is a string – an expression, which seeks to represent a set of strings. Regular expressions are familiar to computer scientists but much less to marketers and others interested in the world of web analytics.
The world of regular expressions can quickly become very complex. However, it is possible to use some simple formulations that can be used on a daily basis with Google Analytics.
Where to use them in Google Analytics
Regular expressions can be used to define a goal and the stages of a funnel , to define a filter and in all the search fields of the reports offered by Google Analytics, keywords, content, traffic sources and others.
To use a regular expression in the goal definition, be sure to choose the "Regular Expression Match" or "Regular Expression Match" option:
Always test your regular expressions before using them for conversion purposes or filters. The simple way is to enter the phrase into a search box in a Google Analytics report and observe the result. For example, via the content report:
The basics
The following special characters represent the main bases for the construction of most expressions, from the simplest to the most complex. A simple way to test
There are others, for the moment, we can be satisfied with that! I will not go into the explanation of each of them but rather through the demonstration of some concrete examples.
The backslash _
As soon as regular expressions are used, it is important to differentiate a special character from a normal character. This is done by using the backslash (officially, backslash) in front of the special character. For example, to find a URL that contains a dash (-) and a period (.), I have to put a backslash in front of the dash and the period to indicate to Google Analytics that I do not want to use these two special characters but to interpret as "normal" text:
/internet-marketing.html
That's it for today, the next episodes will go into more detail about how expressions work.