Google Analytics regular expressions are undoubtedly the intermediate segment in terms of knowledge of this tool. This knowledge is rather hidden in the depths of Google tutorials, it is also in vain to look for factual guides that show the use of such expressions in reports.

However, it’s understandable in the end, because Google Analytics itself was created with small and medium-sized resources in mind, rather than large-scale data. Its older sister, GA 360, in turn, hides all the custom reports we will need.

And their most serious brother – Google Big Query, only gazes indulgently at younger sisters who communicate with each other with dots, commas, and exclamation marks instead of the good old database language. But enough of this very literary introduction – let’s get to the heart of this post, i.e. the language of secret communication with Google Analytics, regular expressions.

What to use Google Analytics regular expressions for?

If Google regular expressions sound strange to you, I encourage you to read the official materials in this scope. It is an extremely useful skill that can be used in many different places such as: channel grouping, filtering views, setting goals.

Useful especially when we manage large Google Analytics accounts and are exposed to sampling our data. The use of regular expressions allows us to limit the amount of data that we need at any given time. Of course, this is one of the many options – I recommend using the dimensions and custom filters in their basic form beforehand to check if it will not give us an answer to the question we are asking.

What are regular expressions?

To put it very simply, regular expressions are information encrypted with special and punctuation characters that the search engine reads as a specific command. Its purpose is to help us filter out the specific conditions we need – for example, all pages on our site that contain the / blog / parameter in the URL.

The meaning of metacharacters

All encrypted commands are expressed with special characters, each character of which corresponds to a specific function. A few of the most useful below.

. any single character (.blog will match whatever has “blog” after its name)

? matching exactly the same phrase or an additional character (? blog: blog, blogs, blog)

+ everything after the character entered matches the expression

| an OR expression that we do not use at the end of the formula (blog | blogs )

^ everything that begins with this character (^ blog: blogs, blogging, blog, blogger)

$ the expression we are looking for is at the end (blog $: eblog, mblog, tblog, oblog)

() matchichng exactly this phrase in brackets in the given order (blog|author)

[] matching exactly like that, but in any order

– an indication of the string within which the phrase is to be searched for (1-9 will find everything between this section)

expresses searching for an exactly selected character, not a regular expression (e.g. blog? looks for the phrase “blog?”)

Summarizing

I hope that my post introduced you to GA regular expressions. Read on soon!

If you liked the post, please share it on your Linkedin, thanks!

Udostępnij wpis w social mediach