In this post I’ll discuss how to create custom channel groupings in Google Data Studio using CASE statements.
Before I begin, I’d like to mention that I’m not the first to write on this topic. ClickInsight has a great article about how to create custom channel groupings in Data Studio and Seer Interactive have a great article on creating CASE statements in Data Studio.
Google Analytics provides us with a Default Channel Grouping to understand how visitors arrive on our website.
For example, here’s a breakdown of the default channel grouping from a Google Analytics account.
While this is fine for understanding our data, it might not be specific enough to have too much value. Our other options are to look at Source, Medium or Source/Medium but they might be too complex.
One way to get a around this is to create your own channel grouping using a CASE statement in Data Studio. This allows you to have control over how you view your data and without making any changes to the Google Analytics view itself.
Deciding what custom Channels we should have
To create our custome channel grouping we need to create a CASE statement. This allows us to segment data based on the criteria we specify. Here’s a previous post about how to use CASE statements to create new geographic regions.
But before we create our CASE statement, the first step is to determine how we should divide up our data.
To figure out what types of channels might be useful, let’s look at a breakdown of traffic by Source/Medium and Device Category.
We can see that a huge amount of traffic is from Google searches on a desktop. That is clearly enough traffic to be a channel on its own. We might also be interested in having Google searches from mobile as its own channel. We can see Twitter is a considerable driver of traffic too. Now that we have an idea how it might be useful to split up our data let’s construct our CASE statement.
Creating a custom Channel CASE statement
The first thing to do is to create a new Data Studio report and add Google Analytics as our data source.
Next, open up our data source and click to ‘Add a Field’.
Then we can create a CASE statement like the one shown below. You can copy and paste this into your own field.
CASE WHEN Source/Medium IN ("google / organic") AND Device Category IN ("desktop") THEN "Google Desktop" WHEN Source/Medium IN ("google / organic") AND Device Category IN ("mobile","tablet") THEN "Google Mobile" WHEN Source IN ("twitter","twitter","t.co") THEN "Twitter" WHEN Source IN ("linkedin.com","linkedin","lnkd.in","facebook","facebook.com","m.facebook.com","l.facebook.com") THEN "Other Social Media" WHEN Medium IN ("social") THEN "Other Social Media" WHEN Medium IN ("referral") THEN "Referral" WHEN Source IN ("(direct)") THEN "Direct" ELSE "Other" END
Below is what it should look like in Data Studio.
We now have our new Dimension, which for this example I’ve named ‘Custom Channel (Oct 2019)’.
I’ve also included other metrics here. The visible metrics are Sessions and Sessions as a percentage of the total. I’ve also included Bounce Rate, % Exit, Avg. Time on Page and Total Event as Optional Metrics. You can see another example of Optional Metrics in this previous post.
The custom Channels dashboard
Below is the dashboard. I won’t go into too much detail on how to create all of the other charts and tables. But it gives us a variety of information about our new distinct channels.
Other Blog Posts
If you liked this article you might like my other blog posts.
Or you can follow me on Twitter!