How to Use Regular Expressions / RegEx in Google Analytics – Tips & Guide



How to Use Regular Expressions RegEx in Google Analytics – Tips and Guide

Regular expressions or RegEx are used to find specific patterns in a list. In Google Analytics, RegEx can be used to find anything that matches a certain pattern. Regular expressions provide a powerful and flexible way to describe what the pattern should look like, using a combination of letters, numbers, and special characters.

For example, if you want to filter your report and to include traffic numbers from one of your website’s section (/software) let’s say www.xyz.com/software (where /software is your section or category), then use the below RegEx

^/software$

This will filter the report and you can see the traffic data only for your section /software.

How to Use Regular Expressions RegEx in Google Analytics – A Complete Guide

Now assume that you also run a campaign targeting the same section /software for example newsletter and used UTM trackers (pattern of your section with UTM tag /software?utm_email=) to track the campaign’s performance then use the below RegEx;

^/software$|^/software.utm

Now you will be able to filter the report that will include your section’s traffic (/software) along with the UTM tracker you used for your newsletter campaign;

How to Use Regular Expressions RegEx in Google Analytics - A Complete Guide

You may noticed that I am using some special characters/regular expressions to only include the section and section with UTM tracker in the report. These are the ^ (caret) and the | (pipe) and I am using them to create regular expression. You can enter your regular expression in the table filter (search box) inside your Google Analytics reports.

Regular expressions can be used in Google Analytics to speed up report customization and for extra flexibility when you’re configuring your reporting views. Here’s a quick summary of all of the places you can use regular expressions in Google Analytics provided by Google:

List of RegEx metacharacters

Wildcards:
How to Use Regular Expressions RegEx in Google Analytics – A Complete Guide

Anchors:

How to Use Regular Expressions RegEx in Google Analytics – A Complete Guide

Groups:

How to Use Regular Expressions RegEx in Google Analytics – A Complete Guide

Escape:

How to Use Regular Expressions RegEx in Google Analytics – A Complete Guide

Here are top 5 tips how to use regular expressions / RegEx in Google Analytics:

Have you tried RegEx or regular expressions to filter your report in Google Analytics? Let’s share your thoughts or if you want any help, leave message in the comment section 🙂

Copy link
Powered by Social Snap