GA4 MIGRATION RESOURCE CENTER
Step Seven: Content Grouping
AT A GLANCE
Define your variable, parameter, and tag to capture content group designations for GA4.
Validate variable and tag function using tag assistant and/or DebugView before using in the standard engagement report or explorations.
Content Grouping
After setting up priority conversions and core GA4 events, continue to migrate your key customizations, such as content groups to categorize pages and screens and allow high-level comparisons of metrics.
Key Tasks
- Create a content grouping using the Google tag.
- Create a content grouping using the GTM.
- Create a content grouping using GA for Firebase.
- Validate content groupings.
GA3 Content Grouping UI
Overview
Content groups allow the categorization of pages or screens into similar groups, revealing metrics for related groups of information. For large blogs, the content groups can reveal relative performance for different types of content posts. For ecommerce sites, different product types can be grouped for reviewing metrics for each product line or category. By providing group-level performance comparisons, GA can help identify areas to drill down and gain more insights.
While the UA platform provided content grouping setup within the UI, GA4 requires a manual but simple method of tagging pages with content variables. As a result, the comparisons are viewable in the Pages and Screens report, or any Exploration report selecting the content group dimension.
Content Groups with Google Tag Parameters
To create content groups of web pages, use the Google tag to directly apply specific content groups to pages. The syntax for applying content groups is below.
gtag('set', 'content_group', '<name_of_content_group>');
For example, if you wanted to identify a page as belonging to the mens clothing group, you could apply this tag:
gtag('set', 'content_group', 'mens');
The content group parameter can be applied globally or for a specific data stream.
Content Groups with GTM Variables
To create content groups of web pages with Google Tag Manager (GTM), you must first create a GTM variable, and then add the variable to your GA4 Config tag.
Create a Variable
- In GTM, select Variables.
- In User-Defined Variables > New
- In Variable Configuration > Regex Table
- Rename the variable as “Content Group"
- In the Input Variable field, select "Page Path" in double brackets (}})
- Add a row to the RegEx Table section
- Enter a regular expression to identify page path.
For example, you may add an entire path such as www.example.com/headphones to capture page activity belonging to the headphone category. However, because regular expressions can include variations, you can add multiple matches as in the below example. Note, in the Advanced Settings, Full Matches is disabled so that partial matches will be grouped in Accessories or Players content groups. In the example below, the pipe symbol (|) separating adapter, headphone, and extension functions as the logical OR operation.
GTM Variable Creation UI
Add the Variable to the Tag
- In GTM, click Tags > Google Analytics: GA4 Configuration tag to open your main config tag
- In the Fields to Set section, add a row with the content group and variable:
- In the Field Name field, enter "content_group"
- In the Value field, enter "Content Group" in double brackets (}})
- Save, test, and publish.
GTM GA4 Configuration Tag: Add Variable
Using path or modified path match works best when a website URL structure matches content groupings. However, a content_group variable can be based on any element that identifies page content. For example, if a content type value is captured in a Data Layer Variable, it can be retrieved and processed in GA4.
Ready to grow?
Uncover customer journeys and accelerate conversions with GA4’s advanced AI and data-driven attribution We can help you get there.
Content Groups with Apps
Once the GA for Firebase SDK is added to an app, GA tracks screen transitions and information attached to the events there. The Google tag parameter is the same parameter used to group content in an app. However, the content_group parameter is sent with screen_view event rather than a page_view event. Depending on your app configuration, you may need to manually log screen_view events. Note, manual and automatic screen tracking is handled differently between iOS and Android.
Additional Content Groupings
While GA4 supports only one content grouping as a primary dimension in the Pages and Screens report, additional groups can be created and registered as custom dimensions. These groups could then be added as secondary dimensions and used in custom reports and explorations. However, they would not be present in the standard report "content group" drop-down.
Page and Screens Report: Content Group Dimension
Validating Content Groups
As always when creating new tags in GTM, after saving your new tag, click on the Preview button. Entering your website URL to connect Tag Assistant. Regardless of tagging methodology, use DebugView to verify variable function in GA4.
- Check the value of the Content Group variable to see that it matches the URL content. This step verifies that the correct value is captured in GTM. You should check the new variable against different URLs representing all of the content types identified in your content groups before publishing.
- In DebugView, click on page_view in the Seconds Stream, then click the resulting content_group parameter. The variable value should display. This step verifies that the value is passed to GA4.
Once data is being collected, content group values are viewable in the standard pages and screens report, or an exploration with the added dimension.
RESOURCES
Content Grouping in GA4: EZSegment article with additional examples for creating content groups with gtag.js and GTM.
Custom Dimensions: GA support on custom dimensions that can be used for additional content groupings.
DebugView: GA support article with steps for monitoring events in DebugView for gtag.js, GTM, and GA for Firebase.
GA4 Content Grouping: main GA support article with gtag.js and GTM examples for creating content groups.
Measure screenviews in GA: Firebase support article covers the multiple ways screens can be tracked. These approaches facilitate the use of the content_group parameter.
SERVICES
GA4 MIGRATION STEPS
STEP 1: IMPLEMENTATION PLANNING
Assess Your UA Configuration and Create Your GA4 Measurement Plan
STEP 2: PROPERTY
Create Property and Plan Tagging
STEP 3: TAGGING AND TRACKING
Connect Data Streams and Add GA4 Tags to Enable Data Collection
STEP 4: EXCLUSIONS AND FILTERS
Implement Exclusions and Filters to Maintain Clean User Data
STEP 5: GOALS MIGRATION
Map and Recreate UA Goals as GA4 Conversion Events
STEP 6: EVENTS
Map and Recreate Priority UA Events as GA4 Events
STEP 7: CONTENT GROUPING
Implement Content Groups with Tag Parameters and Variables
STEP 8: CUSTOM DIMENSIONS AND METRICS
Map and Recreate UA Dimensions and Metrics to GA4
STEP 9: AUDIENCES
Recreate UA Audiences by Configuring GA4 Conditions
STEP 10: LINKS AND INTEGRATIONS
Replicate Current Links and Integrations in GA4
STEP 11: REPORTS
Map Reporting Needs to Standard, Custom, and Exploration Reports
STEP 12: VALIDATE, PREP, LAUNCH
Validate GA4 Data, UA Archival, and User Readiness and Launch
Need help with GA4 migration?
Businesses depend on accurate, relevant data driving a tuned analytics platform. With the UA sunset approaching, create a migration plan that matches your needs and expands capabilities. We can help you get there.