4 Regular Expressions Tips You Should Know for Advanced Google Analytics Analysis

Creating custom Google Analytics segmentations helps you identify and compare performance of different age groups, genders, and web visitors from various cities which helps you make a better decision on how you should allocate your advertising budget. 

To create advanced segmentations, use regular expression or also known as regex or regexp. Regular expression is a sequence of symbols and characters that express a string or pattern to search for specific text in a longer piece of text. The FIND and FIND AND REPLACE feature in Word uses regular expression to find specific text you want to search for in a Word document. You can also use regular expression to segment Google Analytics data for advanced data analysis and gain insights about your digital marketing campaigns and target audiences. Here are four regular expressions you should use:

1.     “OR” Condition

The pipe or | (SHIFT + BACKWARD SLASH) lets you create an “or” condition in your Google Analytics account to match multiple values. For example, you can create a social media traffic segmentation by using referral as the source and Instagram|Facebook|Instagram|Pinterest|Twitter|YouTube to aggregate data from your social media channels. The condition means traffic from Instagram OR Facebook OR Instagram OR Pinterest OR Twitter OR YouTube. Once you have aggregated the traffic, you can see the overall trend in your social media visitors.

Google Analytics Regular Expression

2. Match Everything Condition

Use the full stop condition to match any single character in a URL or a piece of content. For example, you can use the full stop condition to find pages that contain a specific keyword in URLs and analyze their website performance.

To use full stop condition, enter a period and an asterisk: .*

Example: I can use the full stop condition to find all blogs that contain the keyword “SEO” by creating this condition in my Google Analytics segmentation: /blog/.*SEO. Once I have segmented the pages, I can analyze these blogs’ bounces rates and navigation summary and compare their results with blogs that are contain a different keyword in their URLs.


3. Match In The Beginning

Use the carrot or ^ symbol to match queries or URLs that contain a certain keyword in the beginning. For example, if you are a Honda dealership, you can use ^Honda to see search queries that contain keyword “Honda” in the beginning. Gaining this information helps you learn more about online search behaviours and make inferences about your current brand equity.



4. Match In The End

The dollar sign or $ lets you match URLs or queries that contain a specific keyword at the end. For example, if the thank you page of your website has the keywords “thank-you” at the end of its URL, you can use the dollar sign or $ to match the thank you page as a destination URL as the Google Analytics goal conversion. Example:


By using these four regular expressions, you can gain insights on your websites’ search query behaviours, conversion frequencies and rates, and performance of different webpage or webpage categories. This information will help you decide on how to allocate your ad budgets better and serve ads to target audiences or create content that will generate better results such as more leads or other forms of conversion.

If you want consultation about your Google Analytics data or website performance, please email us at raywang@rwdigital.ca or submit a form below.

Get In Touch

Contact Us

We are here to help you 7 days a week. If you have any questions or want to say ‘hi’, please feel free to get in touch!