Update time: January 11, 2025
This article introduces how to set up Content Groups in Google Analytics 4:
- One is Content group, which is a built-in field of GA4, you need to set content_group in GTM.
- One is Custom Dimensions (User Property), which is also called User-Scope Custom Dimension.
Content group
GA4 has a built-in field called Content group in GA4 “Pages and Screens” reports, but there is no data, and it is all “not set” because it has not been set yet:
For the reason of not set, read more : “not set” in Google Analytics 4 (11 Case)
Step 1 : Group Pages
First, we need to group the page paths. We can use JavaScript Variable or RegEx Table Variable in GTM. Here I take RegEx Table Variable as an example. Create a RegEx Table Variable in GTM and set it as follows:
Step 2 : Set the content_group Parameter
Secondly, set content_group in the Configuration settings of the GA4 basic page tracking code(Note that this setting is in the GA4 base page tracking code.)
Step 3 : Preview and Release
Finally, preview testing and release:
The test is as expected and can be released and data collected.
Read More:
Step 4 : Verify data in the Report
You can see the following data in the Content group:
Custom Dimensions(User Property)
That is, set page grouping as a Custom Dimension.
Step 1 : Group Pages
The first step is the same as above.
Step 2 : Set up Custom Dimensions
Secondly, create a Google Tag: Event Settings variable in GTM and set it in “Google Analytics User Properties” as follows (If you have already created Google Tag: Event Settings, add cg settings in Property Name):
Name it “Common Event Parameter”.
Next, set the variable Common Event Parameter to the Event Settings Variable in the GA4 basic page tracking code(Note that this setting is in the GA4 base page tracking code.), such as:
Step 3 : Preview and Release
Finally, preview testing and release:
The test is as expected and can be released and data collected.
Read More:
Step 4 : Register Custom Dimensions in GA4
This custom dimension also needs to be registered in Custom definitions before it can be used. Create a custom dimension as follows in Custom definitions:
Step 5 : Verify data in Real-time Report
You can see this dimension of data in real-time reports:
Summarize
It is recommended to use the first type(Content group), after all, it is a built-in field.