Grouping Content with Content Groupings

This week I had the pleasure of presenting a workshop on Google Analytics at WPCampus in Buffalo, NY. One feature I demonstrated during the session was using content groupings to be able to better understand sections of your website as comparative units. After talking with some other folks, I decided that a more in depth discussion of this feature and some examples were warranted. So, here you go!

What the hell are content groupings, you may be asking. The setting is pretty self descriptive – it’s a feature in the View administration of Google Analytics that lets you define stuff in a section of your site as belonging to some kind of category. Google’s documentation uses a store example, showing how collections of products can be grouped together based on the facet nomenclature they use.

Initial Content Groupings Panel

Initial Content Groupings Panel

The example I’ll demonstrate uses the course section levels of an imaginary course catalog from my demo site. As you can see above, I’ve set up three content groupings (with two I’ve deprecated). Similar to Goals, once you make a grouping, you can’t actually get rid of it. You just have to turn it off or repurpose it. It’s also worth noting that you are limited to 5 total grouping categories, so take some time to plan ahead if you think you might use the feature heavily so that you create your top level groups in a way that provides the most utility value.

Making a new Content Grouping via tracking code

Making a new Content Grouping via tracking code

Creating a Content Grouping is as easy as hitting the New Content Grouping button and giving it a name. That’s step one. This is the name you’ll see when you use the Content Grouping feature in analytics reports. From there you’ll be presented with three ways to determine the groups that will appear with this selection. The first one is by enabling tracking code. This means that you’re telling Google that you’ll be supplying the names dynamically using JavaScript code on your site (or that you’re going to use a tag in Tag Manager, see the section down at the end).

If you use the tracking code method, make note of the code version that’s appropriate for your analytics implementation (most like Universal Analytics at this point). You’ll want to copy that into some JavaScript somewhere on the page that matches the group you’re telling Google this belongs to. So in my case, my Content Grouping is name Courses, and the group names I’m going to be using will be 100 Level Course and 200 Level Courses. In my case, I’m not going to use this approach, but if I did, the code on a course page for Freshman would look like:

ga('set', 'contentGroup1', '100 Level Courses');

The second option you have for making group names is using an extraction rule. This allows you to use regex to define part of a page path, page title, or app screen name to supply the group name by convention. Given the page structure from my example, that would look something like:

Using page path to determine the content group name.

Using page path to determine the content group name.

This is okay, and works, but does mean my content group names would be a little ugly. In my case, the names would just be 1xx or 2xx based on my URL. Usable, but not pretty. Page Title extractions could provide better readability, but in my case, the page titles don’t include text data that would serve the purpose well. It’s also worth mentioning that in this and the next option, you can set up multiple extractions if content that matches your group appears in different parts of your website. These rules will apply in the order you list them, much like the applications of filters on views. Once something matches an extraction, it stops checking.

The final option is my favorite, and affords a lot of flexibility without too much additional effort. It’s basically a slightly more advanced version of the extraction option. This is Group Using Rule Definition.

My catalog rule definitions.

My catalog rule definitions.

Here you can see I’ve created two group names, each one based on the sections of the catalog I have made. Obviously a real Content Grouping could have a lot more, but this is just a demonstration case. So you get two. Rule Definitions are basically like custom named Extractions, using the name you provide, rather than the match that was made by the extraction. So if we look at one, we see a similar matching setup as the case above.

Rule to match all 100 level courses.

Rule to match all 100 level courses.

With these rules in place, Google Analytics will begin tracking pages that match my regex so that I can see them in my content reports. This is incredibly useful for comparing whole areas or types of content in aggregate against each other. So, if I wanted to see how traffic compared for different chunks of classes in my catalog, I can just go view my Behavior > Site Content > All Pages report, and look in the options for your Primary Dimension where you now have the option to change the Content Grouping to the group of your choice, in my case Courses.

Viewing a content report with content groupings enabled.

Viewing a content report with content groupings enabled.

Now I can see that users looking at 200 level courses in my imaginary catalog have a substantially higher exit rate (note: I switched this report to the Comparison view using  the buttons on the right just above the data table) than the 100 level course, and way higher than everything else. Whenever you see the (not set) value in your content grouping dimension, that represents the content on your site that wasn’t assigned any group name under a Content Grouping. It’s basically there to give you something of a baseline for the rest of your site that can be compared to your groups.

With this in mind, you can start to think about all the ways you can apply it to a university site or elsewhere to clump together all the large areas of content where you have many different sections that you’d like to compare against others. Some ideas might be (format following a Content Group > Group Name structure):

  • Academic Departments > Department Name
  • Colleges > College Name
  • News > News Category
  • Athletics > Sport Name
  • Student Life > Service Type
  • Events > Event Category
  • Locations > Location Type
  • Majors > Major Name

Doing this, if your Physics Department has an 87% exit rate, you can compare that in its entirety against the Communication Department’s 32% exit rate and realize that maybe there’s an issue with the Physics section of your site that’s making people leave. It eliminates the need to make more complex calculations or custom reports with Data Studio or elsewhere to determine how those chunks compare.

One more technical note I’ll drop in is that you can also use Google Tag Manager to determine category group names as well. As I mentioned at the start, you can use tracking code as the transport mechanism for the name. Simo Ahava has a tutorial on doing this with Tag Manager. It’s a little old (you’d use the Google Analytics Setting Variable now), but it will still give you the basics.

Content Groups in Google Tag Manager

Content Groups in Google Tag Manager

His example uses multiple tags for pageviews to accomplish this. In the above screenshot, I’m using variables in a single pageview tag instead, which can use a JavaScript Variable or dataLayer Variable to check the path of the page and determine with content group index it should be pointing at, and how it should get the name based on that. This offloads some of the responsibility to you to create the code that decides all this, but that also makes it the most flexible approach and somewhat easier to maintain than doing the same thing in a raw JavaScript file used by your site template.

That’s the long and short of using Content Groupings in Google Analytics. Think about how you might apply them, or share your current implementation in the comments below for others to see.