How to Group Pages in Google Analytics
Tired of scrolling through an endless list of individual URLs in Google Analytics 4? Grouping your pages into logical categories like "Blog," "Product Pages," or "Landing Pages" helps you see the bigger picture and understand which types of content are actually working. This article will show you the most effective method for creating page groups in GA4 so you can move from raw data to real insights.
Why Group Pages in Google Analytics 4?
Analyzing individual page performance has its place, but it often feels like you're lost in the weeds. When your website has hundreds or even thousands of pages, comparing the performance of individual blog posts is less impactful than understanding the overall performance of your blog as a content category. Grouping pages is about trading granular noise for high-level clarity.
Here are the primary benefits:
- Simplified Reporting: Instead of a long list of
/blog/article-1,/blog/article-2, etc., you see a single line item for "Blog." This makes it easy to compare aggregate performance across your most important content types at a glance. - Actionable Insights: Quickly answer strategic questions. Is your blog driving more user engagement than your services pages? Are visitors to your product pages converting at a higher rate than general site visitors?
- Better Content Strategy: When you understand which categories of content resonate most with your audience, you know where to invest your time and resources. If "Case Studies" consistently lead to goal completions, you have a clear signal to create more of them.
- Clearer Communication: It's far more effective to tell your team or stakeholders, "Our blog content drove a 30% increase in engaged sessions this quarter" than to show them a spreadsheet with 150 individual URLs.
The Best Way to Group Pages: Google Tag Manager
While Universal Analytics had a built-in "Content Grouping" feature, GA4 requires a different approach. The most robust and flexible way to create page groups is by using Google Tag Manager (GTM) to send a custom parameter along with your pageview events. You then register this parameter as a "custom dimension" in GA4, which allows you to use it in your reports.
Don't worry if that sounds technical. We'll walk through it step-by-step.
Free PDF · the crash course
AI Agents for Marketing Crash Course
Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.
Step 1: Define Your Page Groups
Before you jump into GTM, you need a plan. Look at your website’s URL structure and decide how you want to categorize your content. The goal is to create a handful of meaningful groups that cover a majority of your strategic content. Most websites use a structure like this:
- Blog: All URLs that live under
/blog/ - Product Pages: All URLs under
/products/or/shop/ - Landing Pages: Pages with
/lp/in the URL or other unique identifiers. - Services Pages: Pages under a
/services/or/features/directory. - About Pages: URLs like
/about/or/team/.
It's also crucial to have a catch-all category like "Other Pages" to ensure every pageview is accounted for.
Step 2: Create a “RegEx Table” Variable in GTM
Once you have your categories, we’ll build a variable in GTM that looks at the URL of every page a user visits and assigns it to one of your defined groups. The "RegEx Table" variable is perfect for this.
- Log in to your Google Tag Manager account and navigate to the Variables section in the left-hand menu.
- Under "User-Defined Variables," click New.
- Name your variable something clear, like "GA4 - Page Group."
- Click Variable Configuration and choose RegEx Table as the variable type.
- In the "Input Variable" field, select
{{Page Path}}. This tells GTM to look at the part of the URL that comes after your domain (e.g., /blog/my-latest-post). - Now, we'll add your rules. Click + Add Row for each group you defined.
Here’s a common setup:
- Row 1: Pattern
^/blog/.*| OutputBlog - Row 2: Pattern
^/products/.*| OutputProduct Pages - Row 3: Pattern
^/services/.*| OutputServices Pages - Row 4: Pattern
^/about/.*| OutputAbout Pages
**Quick Explanation:** `^/blog/` means "starts with /blog/" and `.*` means "followed by any characters." So, this rule will catch any URL in your blog directory.
Finally, check the box for Set Default Value and enter Other Pages. This is your catch-all for any URL that doesn't match your rules. Save your new variable.
Step 3: Add the Variable to Your GA4 Configuration Tag
Next, you need to tell GTM to send this information to Google Analytics every time a page is viewed. We do this by adding our new variable as a parameter to the main GA4 tag.
- Navigate to Tags in GTM and find your main GA4 Configuration Tag (it’s usually named something like "GA4 Configuration"). Click on it to edit.
- Under "Event Parameters," click Add Row.
- In the "Parameter Name" field, enter a name for your dimension. Keep it simple and use snake_case (all lowercase with underscores). A good choice is
page_group. Remember this name exactly, you'll need it in the next step. - In the "Value" field, select the variable you just created by clicking the lego-brick icon. Choose your "GA4 - Page Group" variable from the list.
- Save your tag. And don't forget to Submit and Publish your changes in GTM.
Step 4: Register the Custom Dimension in GA4
The final setup step is to tell GA4 what to do with the page_group parameter it's about to start receiving. You need to officially register it as a custom dimension.
- Go to your Google Analytics 4 property.
- Click on Admin (the gear icon) in the bottom-left corner.
- In the "Data display" column, click on Custom definitions.
- Click the Create custom dimensions button.
- Fill out the configuration fields:
- Click Save.
That's it for setup! It can take 24-48 hours for data to start flowing into your new custom dimension.
Step 5: Using Your "Page Group" Dimension in Reports
Once data begins to populate, you can add your new dimension to any standard or custom report in GA4.
The best place to start is the "Pages and screens" report:
- In GA4, go to Reports > Engagement > Pages and Screens.
- By default, this report shows individual page titles or paths. Click the pencil icon (Customize report) in the top-right corner.
- Under "Report Data," click on Dimensions.
- Click Add dimension and find your new
Page Groupdimension in the list. - You can make this the default primary dimension by dragging it to the top of the list or by clicking the three dots and selecting "Set as default."
- Click Apply, then Save > Save changes to current report.
Your report will now be neatly organized by the content groups you created, showing you aggregated metrics like Views, Users, and Engagement Rate for each category.
Free PDF · the crash course
AI Agents for Marketing Crash Course
Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.
A Quicker Method for On-the-Fly Analysis
If you need a quick answer and don't want to go through the GTM setup, you can use filters directly within the GA4 interface. This method is temporary and less scalable, but it's useful for ad-hoc queries.
- Navigate to the Pages and screens report.
- Click the Add filter button at the top of the report.
- Create a condition:
- Click Apply.
The report will now only show you data for URLs containing "/blog/". This helps you see the performance of your blog content in isolation, but you can’t easily compare it side-by-side with other content groups in the same view. For that, the custom dimension method is superior.
Final Thoughts
Organizing your website content into groups changes Google Analytics from a massive data file into a strategic analysis tool. By setting up a "Page Group" custom dimension via Google Tag Manager, you gain the ability to quickly see which content types are driving engagement and results, allowing you to make smarter, data-informed decisions.
Configuring tags and custom dimensions is a perfect example of the manual work often needed to get simple insights from analytics platforms. We built Graphed because we believe getting answers about your business performance shouldn't require that level of technical setup. After a one-click integration with Google Analytics, you can just ask questions in plain English like, "show me website traffic by content type ranked by user engagement" and get an auto-updating dashboard in seconds, without ever touching Google Tag Manager.
Related Articles
How to Create Facebook Ads API for Claude Code
Create a Meta Marketing API access token that never expires, using a system user, so Claude Code can pull Facebook ad reports and manage campaigns.
ClickHouse vs Postgres: When to Switch to Columnar
Comparing ClickHouse vs PostgreSQL means matching storage architecture to workload. Row storage wins for transactions. Columnar wins for scan-heavy analytics.
Google Ads for Orthodontists: Get More Booked Consults
Most orthodontic Google Ads campaigns waste money on low-intent searches. The problem is structure, not the platform.