Google Analytics 4: URL Filtering Fixes

Genrate a report for a list of specific URLs


In UA we could input multiple URLs in the advanced search, separate them with pipes, and then get that list back with data. 

I cannot, for the life of me, figure out how to do this is GA4. Anyone have a solution? I tried RegEx and couldn’t get the list back.
Details
Reporting

Locked

The short answer is:

What is the equivalent of the pipe filter for multiple URLs in Google Analytics 4?

The most direct and correct way to filter a report for multiple specific URLs in a Google Analytics 4 (GA4) Standard Report or Exploration is to leverage a Regular Expression (RegEx) filter with the pipe symbol (|) as the logical OR operator.

Although you attempted RegEx, the key is to construct the pattern correctly to include all your target page path or page location values.
For a precise match of your list of pages, you would use a pattern like (^/page-a/$|^/page-b/$|^/product/123$), where ^ denotes the start of the string, $ denotes the end, and the pipe | separates each full, absolute path you want to include, effectively replacing the pipe-separated list of exact matches that Universal Analytics allowed.

For highly complex or dynamic filtering and massive lists, the most robust, scalable, and cost-effective solution for a marketing technologist is to bypass the GA4 UI altogether and use the Google Analytics Data API to programmatically fetch the data, applying the list of URLs as an advanced dimensionFilter using the inList operator or a powerful RegEx.

The long answer is:

The problem you’re encountering stems from the differences in reporting interface logic between Universal Analytics (UA) and Google Analytics 4 (GA4), where the simple pipe-separated inclusion for multiple exact dimensions in UA is replaced by a more universal reliance on Regular Expressions in GA4โ€™s filtering mechanisms.

Your initial attempt at RegEx likely failed because the pattern wasn’t precisely defined to capture the multiple, exact paths you needed, which is a common hurdle when transitioning.

To solve this within the GA4 UI, you need to use the matches regex filter condition in either a standard report (if you have permission to customize it) or, more preferably, in a new Exploration report, and use the pipe character (|) to logically connect each specific URL path you want to include, making sure to escape any special characters like periods (.) with a backslash if they are part of your URL path, and anchor the expression to ensure exact matches.

For example, if you wanted the paths /about and /contact-us, the correct RegEx for the Page path dimension would be ^/about$|^/contact-us$, where the ^ and $ ensure there are no unintended partial matches, which is critical for accuracy.

While the RegEx solution works for moderately sized lists of URLs, the most flexible and scalable solution, especially for a large list of URLs or for recurring, automated reporting, is to integrate directly with the Google Analytics Data API.

This approach is cost-effective because once set up, it minimizes manual data manipulation and the risk of human error from incorrectly constructed RegEx strings in the UI.

By utilizing the Data API, you can construct a programmatic query that precisely defines your list of URLs using a FilterExpression.

Within the API, you can use the filter object with a stringFilter type and the matchType of FULL_WITH_REGEX to apply the same path1|path2|path3 RegEx pattern, or if your list is a finite, exact set of pages, you can construct an InListFilter to match a list of exact dimension values without needing complex RegEx, providing superior clarity and maintainability for your technical team.

Furthermore, integrating the Data API with a tool like BigQuery or Looker Studio allows for persistent storage of your raw data and the creation of dynamic, interactive dashboards that can be filtered on-the-fly using the URL list as a parameter, making the reporting significantly more versatile than what’s available in the native GA4 UI, ultimately saving significant time for your analytics consumers

About The Author