Clear search
Close search
Google apps
Main menu

Google Analytics Content Groups

Content Grouping in Google Analytics lets you group your site or app content into a logical structure and see that structure reflected in Google Analytics reports. For example, instead of viewing the data for your ecommerce site by page, you can view data for "Men's Clothing" and, within that grouping, by "Shirts" and "Accessories".

You define your top-level content groupings (for example, "Men", "Women") in the Google Analytics user interface (go to Admin → View → Content Grouping). For the sub-groups (for example, "Shirts" and "Accessories"), Google Analytics gives you the option to group pages via the tracking code. Google Tag Manager simplifies this by providing a Content Groups option for the Google Analytics and Universal Analytics tag types.

Here's how to get started creating content groupings:

  1. Create a top-level content grouping in the Admin section of Google Analytics. In Google Analytics, navigate to Admin → View → Content Grouping.
  2. Click Create New Content Grouping.
  3. Provide a Content Grouping name (for example, "Men") and click Enable Tracking Code.
  4. Select an index number (1-5). This number will be associated with the Content Grouping name you provided; you'll use this number when you create your tag(s) in Google Tag Manager.
  5. Click Done and Save.

For more information, read Create/edit Content Groups in the Google Analytics help center.

Add Content Groups to Your Page Tag(s)

Next, you'll need to add Content Groups to your existing Google Analytics (or Universal Analytics) pageview tracking tag(s).

  1. Under More Settings, expand Content Groups. Click the Add Content Group button to add a new row of content grouping information.
  2. For the Index field, enter the index number of the top level Content Grouping that you defined in Step 1.
  3. Under Content Group, enter a sub-group name (for example, a string like "Shirts", or the name of a variable).

You may add multiple Index-Content Group pairs.

If you enter a string in the Content Group field (for example, "Shirts"), you'll need to modify the tag trigger(s) so that the tag fires only on the pages that belong in the "Shirts" Content Group. In this case, you'd need to set up a pageview tracking tag for each of your Content Groups. However, if you create a Lookup Table variable and enter the name of this variable in the Content Group field, you can use a single pageview tracking tag that fires on all pages.

Here's how to create a new variable for your content groups:

  1. Click Variables in the left hand nav.
  2. Click the New button.
  3. For Variable Type, select Lookup Table.
  4. Enter a Variable Name such as "Content Group".
  5. Set the Input Variable to {{url path}}.
  6. Add your lookup conditions by clicking the Add Row button and entering the following:

Input Output
/shirts Shirts
/ties Accessories
/belts Accessories

  1. Click Create Variable.

Next, use this variable that you created in the previous step in a Content Grouping slot within a single pageview tracking tag that fires on all pages. You will find this setting in Edit Tag → More Settings → Content Groups.

Index Content Group
1 {{Content Group}}

Click Save Tag and you're done.

Was this article helpful?
How can we improve it?