Regex Google Analytics

RegEx Look up tables in Google Analytics

Look up tables with Google Analytics regular expressions

We tell you what they are, how they work, and what regular expression tables are used for in Google Analytics, also known as RegEx lookup tables.

Regex Google Analytics

REGULAR EXPRESSIONS

Regular expressions, also known as “Regex”, are a sequence of characters that form a search pattern that is used to search for very specific patterns. Thanks to this we can find large portions and / or combinations of characters that allow us to capture data that is familiar. For example: all URLs that contain a folder “/blog/”; or if we know that a coupon always starts with a decimal and follows from a letter from “A” to “C”, regular expressions will allow us to identify this pattern and perform an action.

Regular Expressions

Regular expressions are usually supported by symbols such as points, admiration signs, backslash, brackets, parentheses, and so on, each with certain functions.

(You can download a RegEx cheat sheet here: https://goo.gl/Hqb9hg )

In Google Analytics we can make use of regular expressions through search tables (RegEx Table). With these we can create filters, goals and find very specific results.

We can create a filter with the function of excluding the IP itself and thus avoid counting in our traffic statistics in GA the visits of the company itself. We could also filter visits to two sites, such as: www.testA.com.www.testB.com

Note:
It is important to note that a regular expression in GA may or may not have characters. Example of regular expressions for GA are:

  • category
  • <meta(.- ?n?r)+?; [?]>
  • /c[ae]r/

LOOKUP TABLES

Technically a lookup table is a vector-shaped structure that replaces a routine with a simple matrix and helps us save processing times by validating input values.

In regular Spanish for non-programmers, it is a set of values with an assigned task, for example:

Example table

In Google Tag Manager we can use Lookup Tables when we want to assign a goal to different values, if we have multiple accounts, or multiple property containers, or different file types to assign an event to. This will optimize the use of the tool.

Within the definitions of Lookup Tables we can use Regular Expressions. For example:

  • •/product //
  • [-a1b2c3]
  • colou?r

With this we will be able to take even more advantage of the tool, optimizing the filters that apply in each definition, however, it is important to make sure that the RegEx used work as we expect and include or exclude the information that is desired, in other words, we have to make sure that the regular expression we use only corresponds to the information we want to capture.

(To make your life easier you can try regular expressions here))

Specialist consulted,

Diana Gámiz

Data Collector

Sources:
https://www.simoahava.com/analytics/the-regex-table-variable-in-google-tag-manager/
http://www.lunametrics.com/regex-book/Regular-Expressions-Google-Analytics.pdf
https://regex101.com/

Share

Share on facebook
Share on twitter
Share on linkedin
Share on print
Share on email