Edit
Contact us
Salocin Group Leaders in data and AI-enabled connected customer experiences
Edit Engineers of connected customer experiences
Join the Dots Independent, data-led media thinking for sustainable growth
Wood for Trees Optimisers of future fundraising performance
  • Home
  • Our services
    • Cloud solutions
    • Data science
    • Modern Data Platform
    • Privacy and AI compliance
  • Our partners
    • Microsoft
    • Apteco
    • Salesforce
  • Our insights
    • Blog
    • Case studies
    • Reports
    • Webinars
    • Whitepapers
  • About Salocin Group
    • Careers
  • Contact Salocin Group
  • Home
  • Who we are
    • B Corp
    • Careers
  • Our work
  • What we do
    • Intelligent data
    • Marketing technology
    • Transformational CRM
    • Our technology partners
    • Privacy review
  • Our insights
    • Blog
    • Case studies
    • Reports
    • Webinars
    • Whitepapers
  • Contact Edit
  • Home
  • Broadcast media
  • Digital media
  • Print
    • Direct mail
  • Data
    • Our work with Herdify
    • EPiC
  • Media agency
  • Our insights
    • Blog
    • Case studies
    • Reports
    • Webinars
    • Whitepapers
  • About Join the Dots
    • Careers
  • Contact Join the Dots
  • Home
  • Services
    • Actionable insight
    • Data discovery
    • Data engineering
    • Data hygiene
    • Privacy review
  • Products
    • InsightHub
    • Apteco
    • Microsoft
    • Data management
    • Consent and preference management
  • Our insights
    • Blog
    • Case studies
    • Reports
    • Webinars
    • Whitepapers
  • About Wood for Trees
    • Operating principles
    • Careers
  • Contact Wood for Trees
Blog

How to use Google Tag Manager to create Content Groupings

By Edit | 22 Nov 2017

We published this a long time ago…

Some of the content in this post might be out of date, and some images and links may no longer work.

Discover who we are and how we may be able to help you today:

Learn more

In the past I’ve written in depth about how to create content groupings and why they’re necessary to get the most information out of your website. There are three ways to create content groupings: tracking code, extraction, and rule defining. This article will be using the tracking code method via Google Tag Manager.

  1. Decide on how you want to group your pages together and what names you want to give the groups
  2. Create a new content group within Google Analytics by going to Admin> Content Grouping>+New Content Grouping
  3. Give your content grouping a name and select “Enable Tracking Code”
  4. Take a note of the index number and save your content grouping
  1. Go to Google Tag Manager, and in Tags, select your Google Analytics tracking tag
  2. In your Google Analytics tag under “more settings” select “Content Groups”
  1. Click “Add new content group”, add the index number that you took note of and the variable that will determine the group name
  2. Save your tag, deploy the container version and annotate your Google Analytics to reflect the changes made

These are the basics of setting up the content group, but “add the variable” is a little vague. You need a variable that extracts the name of content group from the page itself. This may be data stored within the data layer or data stored within the page DOM itself.

How to create a Data Layer or DOM Element Variable in Google Tag Manager for content groupings

One example that I’m going to use is how we put Branded3’s blog into categories by article type (e.g. Analytics, SEO, PR).

This data is already stored on page. For example What we know about gtag.js, the new Google Analytics Global Tracking tag is an “Analytics” blog post, which you can see here:

Since every blog post is tagged up in this way, we can extract the blog post category straight off the page. After inspecting the element, we can see that it lives within a span called “meta-category”.

To import this into Google Tag Manager as a variable, create a new variable with the following specification:

Variable Type: DOM Element

Selection Method: CSS Selector

Element Selector: Meta-category (this will change depending on what you’re trying to extract)

Be aware: Although this method is developer-light, if your website changes, the DOM Element may change or cease to exist. As well as this, the DOM Element may be different on the user-end (e.g. if they use a plugin or if they translate the page). This could bring in unexpected results.

One way to reduce this sort of anomaly is to utilise the Data Layer to extract the category. I’ve previously shown the value of the data layer in using custom dimensions to make an author report.

If you use the data layer, the code does not sit within the page itself so cannot be extracted using a DOM element variable. To see what Data Layer variables exist on a page, I use James. Clicking the “Data Layer” tab of this plugin allows you to see the names and values of data layer variables.

Make a note of the data layer variable name (for example the above it “author”) when creating your new variable. This needs to be in the form.

Variable Type: Data Layer

Data Layer Variable Name: author (this depends on what you want to extract)

Data Layer Version: Version 2

Once these variables have been created, you can attach them to your tag as we showed above.

If you have any questions about creating content groupings for Google Analytics (either using Google Tag Manager or without it) feel free to get in touch.

We published this a long time ago…

Some of the content in this post might be out of date, and some images and links may no longer work.

Discover who we are and how we may be able to help you today:

Learn more

Share this

  • Email
  • WhatsApp
  • LinkedIn
  • Facebook
  • X (Twitter)

More insights

AI isn’t going to take your job (unless you really want it to) 
Blog

AI isn’t going to take your job (unless you really want it to) 

By Edit | 18 Jun 2024
Customer relationship marketing: How generative AI is revolutionising engagement  
Blog

Customer relationship marketing: How generative AI is revolutionising engagement  

By Edit | 4 Apr 2024
Personalisation as a process
Blog

Personalisation as a process

By Edit | 8 Mar 2024
  • Privacy policy
  • Cookie policy
  • Ts&Cs
  • Report a concern

© 2025 Edit, part of Salocin Group Ltd. All rights reserved. Company no.: 0362​4881. VAT no.: 4208​34911.

Salocin Group Certified B Corporation | Cyber Essentials Certified | British Assessment Bureau, ISO 27001 Information Security Management
Salocin Group
Your cookie preferences

We use cookies to ensure this website functions properly, to analyse website traffic and for marketing purposes.

Functional Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
Manage options Manage services Manage {vendor_count} vendors Read more about these purposes
View preferences
{title} {title} {title}