Creative ways to use regex in Google Analytics and Google Search Console

When it comes to digital marketing you are only as good as the reporting you can show. Google Analytics and Google Search Console are the two most common and popular analytics and reporting tools available and each is capable of delivering so much valuable data but how do you know what data to show?

In this blog post we will talk about something every digital marketer should be leveraging but not enough people are, that something is called regex.

What is regex?

Regex, or regular expressions, is a powerful tool used in web analytics to extract specific data from large amounts of text. It is important in web analytics because it allows analysts to quickly and easily identify trends, patterns, and anomalies in their data. Without regex, analyzing large amounts of data would be a tedious and time-consuming process.

Using in Google Analytics 

By using regex, you can quickly identify and extract relevant information, making it easier to analyze and understand. For example, regex can be used to extract the value of a specific metric from a set of data points, or to extract the URL of a particular page. In this way, regex can greatly improve the efficiency and accuracy of data analysis in Google Analytics.

Filtering out specific data in Google Analytics with regex

Regex can be used to filter data in Google Analytics, making it easier to focus on the most important information and improve the accuracy of your reports.

For example, you can use regex to remove all references to “utm” parameters, which are often used for tracking campaigns, leaving only the relevant data for analysis. This can save time and make it easier to identify trends and insights in your data.

By applying a regex such as (utm|cid=) for example this would pull in all of the URLs that contain a UTM or a CID.

Free SEO Training Tips

Interested in learning more technical SEO tips? Check our my free Technical SEO Tips and Tricks in my blog.

Find Trends and Patterns in Google Search Console

Regex can be especially useful when trying to identify specific issues or trends in search engine optimization (SEO) performance. For example, you may want to use regex to find all instances of a particular keyword throughout a set of search queries, or to identify any pages that have been affected by a recent algorithm update.

One practical example might be creating a regex by subfolder to identify the success of a particular SEO project. Let’s say you hired an SEO agency to try and increase the traffic to your product or service pages. 

In the first image we can see the overall organic traffic is rising which is fantastic. All is good right? 

google search console rising impressions

Apply Regex in Google Search Console

Now we apply a regex to exclude blog traffic. The regex looks like this (blog|articles|tips) what this does when applied to Google Search Console “does not match” regex is it will filter out any clicks coming from those sections (subfolders) of the website.

google search console regex excluse blog

Regex Findings

When exclude the blog, articles and tips sections from the website we can see the traffic actually has slightly decreased since this project started which makes the campaign unsuccessful.

Without the power of regex, this task would have taken hours on end to complete via spreadsheets but with regex this was done in just a few minutes.

gsc decline in impressions

Final Thoughts

As an ethical SEO consultant my goal is put my client’s best interests in play at all times. Reporting is the most important thing if you are going to make data driven decisions. By leveraging the power of regex this makes data driven decisions possible all while saving clients hundreds of hours throughout a year.


Shane Hampson

Shane Hampson

Ethical SEO Consultant

Data Driven Marketer. Fantasy Football Champion. Dog Lover. Foodie.

Ready to take your SEO to the next level?

Now that you have read about SEO on the blog, it’s time to plan your next move. Please book a strategy session, and we can discuss your plan of action.

Recent Blog Posts