Posted on

I am amazed at how little attention the new Google Data Studio has gotten. I’ve been working with complex systems out there; There are a ton of “data studios” which are extremely complex that need trained people to operate and deliver something (usually not that pretty) on the screen.

The Google Data Studio is pretty simple and offers great integration of the default data sources, especially Google Analytics. More important they also offer Google Sheets support which means, everything you need to import you can simply import into Google Sheets (which has various Plugins for APIs) and then get it into Google Data Studio.

Here is a simple example but powerful of Google Data Studio. We will implement “Content Groupings” for historical data.

What Are Content Groupings?

Content Groupings let us compare different parts of the same website. For instance:

  1. The news part of a website
  2. subpages displaying product information
  3. parts like FAQs, forums,…
  4. an online shop
  5. corporate information like job listings or the legal notice

The target groups for those kinds of content may differ. Accordingly, the visitor intent and thus key metrics like conversion rates, bounce rates and the likes vary quite a bit.

We’d also might be interested in comparing specifically designed SE landing pages versus blog entries or the likes for their effect on conversion rates.

So let’s try to implement this feature in Google Data Studio to analyze historical data. The steps involved are pretty simple.

Step 1: Create a new data source (your Google Analytics view)

Step 2: Create a new “calculated metric” which will be your content grouping to group the page URLs into the content groups.

Step 3: Connect your data source to a new Data Studio Report

Step 4: Make a pretty report

Step 1: Create a New Data Source

Go to the Google Data Studio, sign up or sign in; Create a new data source by clicking the large “+” on the bottom right. Then select Google Analytics, your property and data view. Don’t forget to give it a name.

Then click on “connect”. You will be redirected to a long list of metrics and dimensions that are now in that data source.

Now we will create a new metric out of the old ones.

Step 2: Create the Content Grouping

To create a new calculated metric, the content groupings, select the blue “+” icon on top of the “Field” column.

Give it a name, I called it “Content Group”.

The interesting part is the formula. For a reference on the type of formula we want to create, a CASE WHEN formula, you can check out the Google Support Answer.

The formula we will use is the following (I’ll explain in a moment):

CASE WHEN REGEXP_MATCH(Page, “.*(/basic/).*”) THEN “Basic Content” WHEN REGEXP_MATCH(Page, “/about/”) THEN “Aboutpage” WHEN REGEXP_MATCH(Page, “/$”) THEN “Homepage” ELSE “Blogpost” END

Let’s dissect the formula. It’s a CASE WHEN formula using regular expression matches. We have four different cases.

  1. If the imported dimension “Page” contains the phrase /basic/, which I reserve for basic overview articles, I want the content group to be “Basic Content”.
  2. If the imported dimension “Page” exactly matches “/about/“ then I want it to be marked as “About Page”
  3. If it’s the home page I wanted it marked as one and
  4. if it’s none of the above, it will be a blog post (which as they are the only purpose for this blog to exist, have the shortest and most readable URLs possible.)
You may of course adapt this scheme as you like. RegEx expressions are so versatile that they can handle any kind of web site structure. Be aware, the Google RegEx standard is case-sensitive.

Step 3: Connect your Data Source

You can now either put the data source right away in a report (with the button on the top right) or create one and then add this data source.

Step 4: Make a Pretty Report

Two specific things you could add are for instance a table displaying the sessions in a certain period (see left side) or a graph displaying trending graphs for each different content group. You can create that by selecting as “break down dimension” your new metric “Content Group”.

4 Replies to “Data Studio Hack – Content Groupings on Historical Data”

    1. Darn, the WP theme messed up my quotation marks. I’ll fix that with the next update.

      Just replace with actual quotation marks (use your keyboard…) everywhere in the formula, and you should be fine.

  1. Are you sure you can actually use sessions with content groupings? I thought you would have to use unique views.

    1. Hi Mario,

      you’re referring to Step 4 where I used a table displaying “sessions” I’m guessing? So you’re right, in Google Analytics you are not able to select a content grouping on a report based on sessions. For the simple reason, that one session will of course in general belong to multiple content groupings. So this table I display is not in Google Analytics default reports.

      However, since we’re calculating this value on the data source, not pulling content grouping data into this report, we are free to display whatever we want. And in this case, the table simply displays the number of sessions that visited (at least one of the pages of) the different content groupings.

      So it’s kind of the answer to the question “”how many sessions did have this content group in their clickstream?”, which in Google Analytics you would only get by applying a segment (for each content group) to some session based report.

Leave a Reply