Skip to content

Do you want to better understand how users engage with specific sections of your website? Setting up content groups in Google Analytics 4 (GA4) using Google Tag Manager (GTM) allows you to categorise your website content into meaningful groups, providing valuable insights into user behaviour and content performance.

In this tutorial, I’ll walk you through the steps to set up content groups in GA4 using GTM, empowering you to enhance your data analysis and inform your marketing decisions.

Header Outline:


Content groups in Google Analytics 4 (GA4) allow you to categorise and analyse your website’s content based on meaningful segments. By setting up content groups using Google Tag Manager (GTM), you can gain deeper insights into user behaviour, engagement, and performance. This guide will walk you through the process of creating content groups in GTM and implementing them in GA4.

Understanding Content Groups in GA4

Content groups in GA4 provide a way to classify your website’s pages or sections into logical groups. These groups can be based on factors such as content type, product category, geography, or any other segmentation that is relevant to your website. By grouping similar content together, you can easily compare and analyze the performance of different content categories.

Setting Up Content Groups in GTM

Step 1: Create a Variable for Content Grouping

  1. Sign in to your Google Tag Manager account and navigate to your container.
  2. Go to “Variables” and scroll down to “User Defined Variables” and click on “New” to create a new variable.
  3. Click on the “Lego Brick” and choose “Regex Table” as the variable type.
  4. Name the variable “Content Group” and set the “Input Variable” to {{Page Path}}.
  5. Underneath “Pattern”, click on “Add Row”.
  6. The “Pattern” on the left hand side should include all possible variations that could be included in the page path for that category. Each variation is separated by the pipe symbol (which is a “|”). Remember words in path pages are separated by a dash (“-).
  7. The “Output” on the right hand side is what you want to name that Content Group.
  8. Rinse and repeat until you have added all your content groups.
  9. Select the checkbox underneath for “Set Default Value” and put in “Other” (or something to describe when none of the options you provided are “true”).
  10. Finally, underneath we need to configure the “Advanced Settings” so the checkbox for “Ignore Case” is selected so the content groups work regardless of upper case or lowercase. The other two checkboxes should be unticked.
  11. Save your changes by clicking on “Save”.

Step 2: Configure a Content Grouping Tag

  1. Assuming you have already created a GA4 Configuration Tag, open this tag.
  2. Click on “Fields to Set” and then underneath click on “Add Row”.
  3. On the left hand side under “Field Name”, type in “content_group” (without quotes), and on the right hand side under “Value”, type in “{{Content Group}}” (without quotes).
  4. Save the tag.

Step 3: Publish the Tag in GTM

  1. Review your changes in the GTM workspace.
  2. Click on “Submit” to publish the container.
  3. Ensure that the container code is implemented correctly on your website.

Verifying Content Groups in GA4

  1. Allow some time for data to populate in GA4 reports.
  2. Go to “Reports”, “Engagement” and “Pages & Screens” and then under the Search bar, select “Content group” to verify the presence and accuracy of content grouping data.
  3. Analyse the performance and engagement metrics for different content groups to gain insights into user behaviour.


By setting up content groups in Google Analytics 4 using Google Tag Manager, you can organise and analyse your website’s content more effectively. Follow the steps outlined in this guide to create content groups in GTM, implement them in GA4, and gain valuable insights into user behaviour and engagement.

Leverage the power of content grouping to optimise your content strategy and enhance your website’s performance.

Back To Top