This article is about Google Analytics 4 properties. Refer to the Universal Analytics section if you're still using a Universal Analytics property, which will stop processing data on July 1, 2023 (October 1, 2023 for Analytics 360 properties).

[GA4] Content grouping

Categorize related pages and screens into custom buckets

Content groups enable you to categorize pages and screens into custom buckets so you can see metrics for related groups of information.

For example, you can create separate buckets for pages that display men's, women's, and children's clothing.

Set up a content group

Use the following drop-downs to see information about how to set up a 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('set', '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('set', 'content_group', 'mens');

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

  gtag('set', 'content_group', 'womens');

You can also set the content_group parameter using the page_view event or set command.

To learn more about the content_group parameter, see the Configuration reference.

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 Variables on the left.
  2. In the User-Defined Variables section, click New.
  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

Google Analytics for Firebase (Mobile apps)

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

See content groups

You can see your content groups by selecting the Content group dimension in the Pages and screens report or selecting the dimension in Explorations.

For example, the following shows the content groups defined in the previous example in the Pages and screens report:

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

When you don't set a content group, Analytics populates the Content group dimension with (not set).

Set 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.

You can set additional content groups by creating custom parameters for the content groups and then registering the content groups in Analytics as custom dimensions.

Was this helpful?
How can we improve it?
Search
Clear search
Close search
Google apps
Main menu
Search Help Center
true
69256
false
false