Dimensions and metrics

[GA4] Create content groups

Content groups let you categorize pages and screens into custom buckets. The custom buckets allow you to see metrics for related groups of information. For example, you can create a bucket for pages with men's clothing and another one for pages with women's clothing.

Configure the content group

Google tag (Websites)

To set up a content group using the Google tag, add the content_group parameter to the web page as follows:

gtag('config', 'TAG-ID', {

'content_group':'<name_of_content_group>'

});

For example, to set up a content group on a page for Men's clothing, you can create a 'mens' content group:

gtag('config', 'G-XXXXXX', {

'content_group':'mens'

});

Similarly, on a page where you show Women's clothing, you could add the following:

gtag('config', 'G-XXXXXX', {

'content_group':'womens'

});

Learn more about the content_group parameter

Google Tag Manager (Websites)

You can set up content groups in Google Tag Manager using a RegEx Table variable. The RegEx Table variable will match a regular expression with the URL that someone visits.

Once you create the variable, you can add the variable to a content_group parameter in your Google Analytics: GA4 Configuration tag.

Step 1: Create a variable
  1. In Google Tag Manager, go to An image of the Variables iconVariables on the left.
  2. In the User-Defined Variables section, click New.A screenshot of the New button highlighted in the "User-Defined Variables" section on the Variables page
  3. Click Variable Configuration > Regex Table.
  4. At the top of the window, rename the variable as "Content Group".
  5. In the Input Variable field, select {{Page Path}}.
  6. Add a row to the RegEx Table section.
  7. Enter a regular expression to identify page path. See an example
  8. Select Set Default Values.
  9. Enter "Other group" as the default content group if nothing matches.
  10. In Advanced Settings, clear the Full Matches Only and Enable Capture Groups and Replace Functionality checkboxes.
  11. Save your changes.

Step 2: Add the variable to the tag

  1. In Tags, open your Google Analytics: GA4 Configuration tag.
  2. In the Fields to Set section, add a row with the content group and variable.
  3. In the Field Name field, enter "content_group".
  4. In the Value field, enter {{Content Group}}.
  5. Save your changes.
  6. Publish the container.

Example

For example, you want to measure the following page paths on your website:

  • Men's clothing page: www.example.com/category/mens
  • Women's clothing page: www.example.com/category/womens

Your RegEx table would look like the following:

Pattern Output
/mens Men's clothing page
/womens Women's clothing page

Firebase (apps)

When you use the Google Analytics for Firebase SDK, you can add the content_group parameter to a screen_view event. Learn more

Report on the content group

To see your content groups, select the Content group dimension in the Pages and screens report or add the dimension in an exploration. For example, the following shows the previously defined content groups in the Pages and screens report:

A screenshot of the "Pages and screens" report, categorized by content groups (not set), mens, womens, and chidlrens

Configure additional content groups

You may want to set additional content groups. For example, you might want a top-level content group for Men's clothing and then content_group2 for Apparel and content_group3 for Shirts.

To configure additional content groups, create custom parameters for the content groups and then register the content groups as custom dimensions. Learn more

Was this helpful?

How can we improve it?
true
Search
Clear search
Close search
Google apps
Main menu