This video shows you how to set up a new content group in Google Analytics 4 using Google Tag Manager. Content groups are useful when you want to be able to see the analytics for particular types of content on your website. For example, you might want to analyse traffic to all your blog posts separately from the rest of your website, or all your event listings or some other group of content that is useful to you. The process for doing this is different in GA4 than it was in Universal Analytics and requires you to be using Google Tag Manager. This video shows you what to do, and there are also written instructions below the video.
How to set up a content group in Google Analytics 4 using Google Tag Manager
- Access your Google Tag Manager account and navigate to the container for the website you want to work on.
- Create a new variable by clicking on “Variables” and scrolling down to “User Defined Variables.” Select “New” to create a new variable.
- Give your new variable the name “Content Group,” and choose the variable type “Regex Table.”
- Select the Input Variable to be “Page Path”
- Configure the regex table by adding rows for each content group you want to track. Enter the pattern you want to search for in the URL, such as “event” or “blog,” and specify the corresponding output that will appear in Google Analytics.
- Set a default value for “other” to cover pages that don’t fall into any specific content group.
- Configure advanced settings – keep “ignore case” checked and enable “Capture Groups” and “Replace” functionality.
- Save the variable configuration.
- Add the newly created variable to your Google Analytics configuration tag. Click on “Tags,” locate the Google Analytics configuration tag, and click on it.
- In the tag configuration, add a new field by clicking on “Field Name” and enter “content_group” as the name. Use double curly brackets to pull the value from the “content group” variable.
- Save the tag configuration.
- Preview the changes by clicking on “Preview” and enter a URL from your website that is in the content group you’ve created to test if the content grouping is working as expected.
- Check the variables to ensure the “Content Group” variable returns the appropriate value for the URL.
- Stop debugging and return to the Tag Manager.
- When you’re satisfied with the changes, click on “Submit” to apply them.
- Provide a title and description for the changes and click “Publish” to make them live.
- Wait for 24 hours to allow data to be collected in Google Analytics.
- Access your Google Analytics account and navigate to the relevant property.
- In the engagement dropdown, select “Pages and Screens” to view the reports.
- Expand the dropdown menu for content listing and select “Content Group” as an additional dimension.
- Review the pageviews and other metrics according to the different content groups you set up in Tag Manager.
Remember, these steps provide a general overview of the process. Detailed configurations and specific settings may vary based on your specific requirements and setup.
How we can help you
If you’d like to learn more about GA4 take a look at our other GA4 resources, articles and free demo videos. We also run a regular Introduction to Google Analytics using GA4 webinar that you might find helpful if you are just getting started with GA4.