Content Grouping is a nice new feature from the good folks at Google Analytics. Basically, it allows you to group your content according to a logical structure. You can create up to five Content Groupings, and you can have as many Content Groups within these groupings as you like. The difference between a Content Grouping and Content Group is hierarchy. The second is a member of the first. Read Justin Cutroni’s post on Content Groupings to get you started.

It’s still obviously in some kind of beta mode, and I saw a number of bugs with the feature when testing for this article. Nevertheless, it’s nice to see Content Groupings as a built-in feature of Google Tag Manager now as well.

X

The Simmer Newsletter

Subscribe to the Simmer newsletter to get the latest news and content from Simo Ahava into your email inbox!

What you get

In some content reports (e.g. Behavior -> Site content -> All pages), you’ll see the new Content Grouping selector among the primary dimensions:

Once you select an existing grouping, you can drill down in the data and compare how different groups fare among the selected grouping.

To be honest, I kind of wish that you could use content groupings to actually filter data on the view level. When I first heard of this feature, I instantly thought of a use case I had with a client. They have two language versions (Finnish and Swedish) running on the same domain, and no folder structure to separate the two, so Finnish URLs and Swedish URLs all mixed together. Content grouping would be a great way to have a separate view for the Swedish pages and for the Finnish pages. For now, I didn’t see content grouping as something you can filter your view data with, nor did I see it as something you can even segment your data with. It’s just a fancy way of grouping and comparing your content.

It didn’t take long for the amazing Google Tag Manager development team to make sure that Content Grouping is doable through the GTM UI as well. Here’s a brief walkthrough of how to do it. In my example, I created one Content Grouping for all my articles. Under this grouping, I want to measure the efficiency of my various articles by category. For this example, I’ll create Content Groups for just my SEO and Analytics articles, but I could just as well extend them to cover all my articles.

I do have a clear URL hierarchy on my website, so I could just as well use Content Drilldown reports to achieve the same thing, but I beg of you to use your imagination here, oh good reader. There are many (much better) applications for this new feature than what I explore here as a demonstration.

Setting up Content Groupings in GA

First, you need to create the Content Grouping for your view in Google Analytics Admin.

  • Go to Admin

  • Under the View of your choice, select Content Grouping

  • Select Create New Content Grouping

  • Give a name for your Grouping

  • Choose + Enable Tracking Code (required for the GTM setup)

  • Choose an index from 1 to 5 (you can only create 5 Content Groupings!)

  • Click Done and Save

So now you’ve created a Content Grouping. Make note of the index number you chose, you’ll need it in GTM. I named my new Content Grouping imaginatively “Articles”. The other grouping in the screenshot below can be disregarded, as I don’t use it in this example.

Modifying your Google Tag Manager tags

To send the Content Grouping data, you need to annotate a pageview tag with the Content Grouping index and group name that you want the pageview to belong to.

In my case, I created two new pageview tags. One that fires only on Analytics article pages ({{url path}} matches regex ^/analytic/) and one that fires only on my SEO article pages ({{url path}} matches regex ^/seo/). I naturally had to modify my “all pages” tracking tag to exclude SEO and Analytics pages, so that I don’t get double pageviews.

To decorate your pageview with a Content Grouping annotation, you need to do the following.

  • Edit your Pageview tag

  • Click More settings / Content Groups / Add Content Group

  • Here, you need to add the index number of your Content Grouping into the Index field, and the name you want for your Content Group in the Content Group field

  • Make sure you have a rule in place to only fire the pageview on pages which you want to have in the Content Group

  • Save tag, Preview & Debug

So remember, the index number refers to the Content Grouping you set up in Google Analytics Admin. Content Group is the arbitrary name of the sub-group you want to appear in your reports, when you drill down through the (maximum of 5) Content Groupings you created.

So Index 1 is my Articles Content Grouping, and then the Content Group is either SEO Articles or Analytics Articles, depending on the folder the page is in. Both Content Groups require a separate pageview tag, naturally.

Test and review

Finally, it’s prudent to test your setup. Always, always use the brilliant Preview & Debug mode of Google Tag Manager to verify your changes. If you’ve done everything correctly, you should see your new pageview firing on a page which matches the rule you set.

Then I use WASP and Chrome Developer Tools to verify that the data is sent correctly. In the screenshot below, you can see the correct parameter (cg1 for Content Grouping 1, and Analytics Articles for Content Group) being sent with the pageview.

And you saw the end result at the beginning of the post.

Conclusions

It’s a nice feature, to be sure. If you don’t have a logical folder structure in your site, or if you want to thematically group content without being able to do so in any other way, Content Groupings just might save the day. They’re easy to set up, and you can add a created Content Grouping as a dimension in your favorite custom reports as well!

Wishlist / feature request list / gripes

  1. Fix the bugs!
    1. I tested the above process twice, and on both times it assigned the content to wrong Groupings, even though I double-checked the Index numbers and what I had set in GTM. So for some reason, content for grouping 1 was put under grouping 2 and vice versa
    2. The “Choose Content Grouping” primary dimension appeared on a whim. Sometimes I saw nothing there, on other times I saw just Test as the name of the menu, and once I saw Page Group 1 instead of the Content Grouping name
  2. Make it possible to filter data on the view level by Content Grouping
  3. Make it possible to create advanced segments with Content Groupings
  4. Improve the tips next to the Content Grouping selector when adding a custom grouping as primary dimension in custom reports. Some of the labels just said Error

Other than that, thanks for another cool feature!