The Content Grouping feature in Google Analytics exists for one very simple reason: to enable you to categorize your digital content into groups which reflect your business goals or reporting requirements.
It’s an underutilized feature, and one that’s often misunderstood by marketers. In this guide I’ll run through some of the best use-cases for content grouping, the various ways in which it can be implemented, the difference between content grouping and custom dimensions, and finally provide solutions to some of the most frequently encountered problems.
Let’s say you run an ecommerce site which specializes in coffee. You sell coffee beans, roasting equipment, grinders, and espresso machines. It’s a wonderful website that dominates in organic search, but you want more insight into which coffee varieties are performing best for your business. In other words, you’re interested in viewing aggregated metrics for a particular type of content. To do this, you’ll need to create a content grouping.
You can create up to five content groupings per View in Google Analytics. Within each of your groupings, you can have an unlimited number of groups. This can be a little confusing, so try thinking of each grouping as a system of categorization (size or color) with the groups themselves being your individual buckets (e.g. large or red). To use our coffee website as an example, we might opt to group our coffee beans into groups which reflect their geographic origin. ‘Origin’ would be our grouping, and Brazil, Vietnam, and Colombia would be a few of our groups.
As can be seen below, we’re now able to view aggregated metrics for each group by setting our ‘Origin’ content grouping as the primary dimension in one of Analytics’ standard Behavior reports. With just a few clicks, we can determine which coffee origin country is driving the highest number of pageviews, which tend to perform best as landing pages, or which have an abnormally high bounce rate.
Before diving into the technicalities of implementation, let’s review a few examples of good content grouping strategies, and how they might help you to better understand the efficacy of your business’s marketing.
Powerful Grouping Strategies
Top Authors: Your content marketing strategy centers around your blog. Your articles perform well on social and in organic search, and while you know which themes tend to resonate with your audience, you want to understand what other factors are in play. By creating an ‘Author’ content grouping, you can see which of your writers is performing best, and use this data to inform ad strategy or post promotion.
Product Performance: You run an ecommerce website with thousands of products, and generally rely on the Landing Pages report to understand which pages are performing well (typically specific category pages), but you want a higher-level view. By grouping all your product pages into buckets which reflect their type, line, or brand, you can get a sense of the cumulative performance of various product subsets.
Rich Content: You are experimenting with new content types including video, whitepapers, infographics, and interactive pieces. You want to know which type of content (i.e. not which specific pages) people tend to spend longest viewing and which result in engagement. By setting up a ‘Type’ grouping, you can sort your marketing materials into logical buckets and measure their aggregated performance.
The insight offered by a smart grouping strategy can be huge. Once you’ve settled on a content grouping strategy, you’ll need to decide how to implement it. If you’re unfamiliar with property configuration and account structure, check out my Beginner’s Guide to Google Analytics before continuing.
There are three main ways of implementing content grouping – rules, extraction, and tracking code. Four, if you include Google Tag Manager. We’ll run through the basics of each method, their advantages and disadvantages, before finally offering some guidance on which you should choose. Note that we’ll be focusing on a web-based implementation, rather than app tracking on Android or iOS.
Whichever implementation method you choose, you’ll need to start by enabling your grouping in Google Analytics. Remember that content groupings are created at the View-level, not the Property-level, so head to your chosen View and navigate to the Admin panel.
Next, hit the red ‘New Content Grouping’ button. Give your grouping a name, and choose how you’d like to configure your grouping. We’ll start with the simplest.
1. Rule Definitions
This is probably the easiest method, and it should be familiar to anyone who’s ever done an advanced search in Analytics. Essentially, it allows you to define groups based on existing dimensions such as URL and page title. Remember that all content groupings are hit-level, not session-level or user-level, so you can’t sort based on dimensions like source or medium. For a refresher on scope and precedence, check Google Support.
Returning to our coffee site example, we’ve prepared rules defining each of our ‘Origin’ groups. The Guatemalan group, for instance, will include all pages where the title includes the word ‘Guatemala’. The ability to combine rules with ‘AND / OR’ operators allows you to fine-tune which pages fall into which groups
Groups can be reordered by dragging them. Note that grouping logic is applied sequentially – Analytics will work from your first ruleset through to your last, stopping as soon as it finds a group which matches. This has two implications: firstly, each page can only be in one group per content grouping, and second, it is best to list your groups in descending order of specificity (i.e. the most specific groups first, and a general catch-all group last).
This is very similar to the Rule-based method. We’re still defining our groups based on existing dimensions, but this time we’re using a regex capture group to parse the dimension and extract the group name. Returning once again to our coffee website, let’s imagine that all the products we’re interested in grouping sit within a tidy directory structure:
We can extract the second folder using the following regex expression:
This will return
brazil, or whatever happens to sit after the top level directory in between the parentheses in our regex expression. This means we can collect all of our ‘Origin’ groups with just a single extraction rule – it’s a more elegant solution than our verbose rule-based definitions, but it requires a very consistent URL structure.
Indeed, this dependence on URL structure and title tag formatting is the main weakness of our first two implementation methods (rule definition and extraction). They both necessitate manual updates of grouping logic whenever new content is added or page titles are changed. Ain’t nobody got time for dat.
3. Tracking Code
As the name implies, this method allows us to group pages using changes to the Google Analytics tracking code. While this does require some development resource, it’s also robust and – if done correctly – very sustainable.
In theory, all you need to do is use the Universal Analytics
set command to pass an index number (a number between 1 and 5 to identify your grouping) and your group name. The two portions you need to replace are shown below in [square brackets].
ga('set', 'contentGroup[Index Number]', '[Group Name]');
The final portion of tracking code for a Guatemalan coffee, for example, would look like this:
ga('create', 'UA-123456-1', 'auto'); ga('set', 'contentGroup1', 'Guatemala'); ga('send', 'pageview');
Simple. But... if you're using Google Tag Manager (GTM), there's the potential to make things even easier to implement and maintain.
4. Google Tag Manager
Technically, this is still a tracking code-based implementation, but it's often simpler to maintain than the previous 'vanillia' approach. Handling grouping in GTM abstracts the functionality away from the on-page tracking code and allows us to build a more programmatic solution.
I'm a huge proponent of deploying GTM alongside a Data Layer. Any remotely complex web analytics setup will likely benefit from having one, and it eliminates the need to rely on the hacks you so often see people using in GTM - scraping product details from HTML markup, for example. Where possible, don't rely on your presentation layer to gather data.
If you're unfamiliar with the concept of the Data Layer, the documentation on Google Developers is quite good. To borrow a phrase from Simo Ahava, the Data Layer occupies the DMZ between developers and marketers; it's a machine-readable structure of semantic information that you want to pass from your website to other applications like Google Tag Manager.
Returning to our coffee example, the (highly simplified) process of implementing content grouping using GTM and a Data Layer would be as follows:
- All product pages push a variable called
coffeeOriginto the Data Layer. This variable's value reflects the product's content group. For example:
- Our GTM container picks this up from the Data Layer, and stores it as a variable (previously known as a macro) which we'll call
dlv - coffeeOrigin. Consistent naming conventions are good.
- The Google Analytics 'Page View' tag which fires on product pages sets this variable as the group for Content Grouping index 1.
As shown by the screenshot above, settings related to content grouping are found under 'More Settings' > 'Content Groups' when configuring the Google Analytics page view tag.
While certainly requiring the most effort up-front, this method of implementation is probably the most robust and sustainable in the long-term.
Which Should I Choose?
Technically, you can use all of them at once. That doesn't mean you should.
We've already established that the grouping logic for rule-based and extraction-based definitions is applied sequentially - Google Analytics will process each ruleset in turn, stopping as soon as it finds a match. However, the three separate implementation methods are also applied sequentially - they can all be active at once. Analytics will first look for a match in the tracking code, then for a matching extraction definition, and finally for matching rule definitions.
That said, this is not a good idea. It's messy and prone to human error. My advice would be to keep it simple and - where possible - stick to one method of implementation per grouping. But which one?
For smaller sites or for temporary experiments, rule-based or extraction-based definitions can work equally well. For larger sites and those with ecommerce enabled, or for anything you intend to track in the longer-term, a tracking-code based implementation - preferably using GTM and a Data Layer - is by far the most robust and sustainable solution.
Whichever you choose, just remember to test, test, and test again.
FAQs & Troubleshooting
Q: Are content groupings applied retroactively?
A: No. Groupings are applied as new data is processed, so you cannot use them to group your existing data - they only function after they've been implemented.
Q: What's the difference between custom dimensions and content groupings?
A: With non-Premium Analytics, you're allowed five content groupings per View, and 20 custom dimensions per Property. Because they're applied at the property-level, custom dimensions are available to use as filters which can be applied to Views - you could create a view which shows only Guatemalan coffee, for instance, which you could not do with a content grouping. Custom dimensions also allow you to use the Custom Data import function, which you can read more about on Google Support.
If neither of these things apply to you, then you should definitely consider using content groupings. Unlike custom dimensions, they can be created with no code changes at all (using rule-based definitions) and can be used with the Behavior Flow report. This allows you to visualize how users are moving between your different content types (e.g. from articles to sales pages to products) and where they are dropping off. Powerful stuff.
Q: What's the deal with (not set) appearing in my content group report?
A: Basically, this represents all items which were not added to any group within a particular content grouping. In other words, none of your rules fired.
Q: I've inherited an Analytics account with a broken content grouping system. All my 5 slots are full. What do I do?
A: Either create a new View and get 5 new groupings, or deactivate the existing groupings - navigate to Content Grouping in the Admin panel and hit the Status switches to off. While you can't remove the legacy data, actual data collection will cease immediately. You can then plan a new, better grouping strategy for that slot.
Whatever you do, remember to add a detailed annotation to the Analytics timeline. As well making you a good all-round human, leaving timeline annotations ensures that others - including future you - will understand what you did.
Thanks for reading, and good luck with your content grouping endeavors.