Content Groups in GA4
Table of contents:
- What are content groups?
- Why should you use content groups?
- Implementation Implementing using a data layer to send content group dataImplementing using GTM based on URL hierarchy.
- Advanced customizations
Checking the data and troubleshooting
What are content groups?
Content groups can be described as a set of webpages which can be categorized under the same theme. For example blog pages, shop, services, etc. Content grouping helps you segment your entire site's content to categorize the analytics associated with each content group individually. In GA4, once you have the content groups set up, you can further break down your data further for events, audiences, and segments by adding content groups as a dimension. You can create multiple levels of content groups so you have categories and subcategories and further nesting of child categories within those sub-categories.
Why should you use content groups?
Content groups are useful because they allow you to categorize your data further and add more meaning to plain web URLs. Although content groups can be seen as adding another dimension to your existing stack, content groups actually reduce the dimensionality of your data by enabling you to group your web pages into various content buckets. If you are not using content groups you are probably having to customize your reporting which can be very time-consuming and inefficient.
You can gain insights into user behaviour and performance in a more meaningful way. Here are some use cases for how you can use content groups for your brand:
1. E-commerce Product Categories:
If you run an e-commerce website, you can create Content Groups to categorize products into groups like "Electronics," "Clothing," and "Home Decor or “Men’s,” “Women’s,” “Children’s,” and then further subcategorize into clothing type, seasonality etc.
2. Blog Post Topic:
For a content-heavy website or blog, you can group blog posts by topics such as "Technology," "Health," and "Travel."
3. User Journey Stages:
By grouping pages into stages of the user journey, such as "Awareness," "Consideration," and "Conversion," you can assess how users move through the funnel and optimize content accordingly.
4. Geographic Regions:
Segmenting content by geographic regions or locations is helpful for businesses with a global presence. You can analyze how content performs in different regions and adapt your strategies accordingly.
5. Website Redesign Evaluation:
During a website redesign or overhaul, you can compare the performance of the old and new versions by creating Content Groups for each.
6. Event Tracking:
If your website relies heavily on events like webinars, seminars, or conferences, you can group related event pages together. This allows you to monitor event engagement and ROI.
Remember that setting up Content Groups requires some initial configuration within Google Analytics, but the insights gained can be invaluable for optimizing your website's content and user experience. It enables you to focus your efforts where they matter most and make data-driven decisions.
Implementation:
There are multiple ways this can be implemented using Google Tag Manager; some allow you a little more customization if needed, and some may require help from a developer to push content information in the data Layer. In all of these methods, we will be using GA4 Configuration Tag to send content group data because that will make sure that the values for these dimensions are sent with each event that we are sending to GA4. Hence, we can be able to utilize that for each event and in relation to all of its parameters. So, let's discuss them all:
Recommended by LinkedIn
a.) Implementing using a data layer to send content group data:
In this setup, you will first need to ask a developer to send a parameter defining the value for each webpage we want to assign to that web content. You can name this parameter anything you want; “section_of_website” is just an example
Demo code:
Please make sure you add this code above the GTM configuration code on site as this info should be available in GTM’s datalayer before any other event is fired or before your GTM container loads so that it is available for you to send along with every event.
You can check if this has been implemented correctly by previewing your GTM container and seeing if the info is being pushed through the data layer correctly. You should see an API call pushed to the data layer as you see in the image below.
The next step is to collect this info from the data layer and send it to GA4. Go to your GA4 Configuration tag and in the configure parameters section, add the parameter name as “content_group”. For parameter value click the “choose a variable” button and click on new, for variable type select data layer variable, you will add the name of the variable you are using in the data layer to push the variable value, for example in our case we used section_of_website . name the variable whatever you want.
By default, GA4 only has one Content Group dimension but as you can see in the screenshot we are using multiple content groups for example content_group, content_group2, content_group3, etc, so these must be added as event-scoped custom dimensions so that you can later use these in your reporting, you can name the dimension as you like but use the event parameter same as you use in Tag manager.
b.) Implementing using GTM based on URL hierarchy:
For this to work correctly, you need to make sure your site is well structured and the URLs are in a proper hierarchy, what meant by that is for example for all of your service pages, the URL goes like mysite.com/services/service1 , mysite.com/services/service2, mysite.com/services/service3 or for your blogs its structured as mysite.com/blogs/blog1, mysite.com/blogs/blog2 and so on.
Then, we will be using custom javascript variables to get these values from the page path variables clean the values and add those parameters as values to the content groups. So, to understand the hierarchy, this is how the URL is being looked at and then segmented - mysite.com/content_group/content_group2/content_group3
The value of the content group can be extracted using the code provided below using a custom javascript variable. The code gets the values from the URL and removes any “/” from it so that it's a much more legible value which can be directly used in reporting.
Similarly, as in the method above, you will need to add custom event-scoped dimensions as well.
Advanced customizations:
This might be a little too technical and not everyone needs it but if you are looking to further add some customization to the final values, you can do so by using lookup tables variables or regex table variables, you can add one more variable before finalizing the value to customize it according to your need. An example use case can be if you have blogs that you would like to subcategorize into blog type, you can add a regex variable such as described in the screenshot below:
Checking the data and troubleshooting
- Use GA4’s Debug view to check if the data is flowing to G4 in all the events by opening individual events and seeing the values associated with content group parameters.
- Make sure you have submitted the latest version of your GTM container after implementing everything.
- Recheck all the codes if necessary.If you have any other questions or concerns regarding this topic or process, please feel free to reach out.