If your website gets a reasonable amount of traffic, you will be getting traffic from a bunch of different sources. This would make your granular marketing reports (eg. Source/Medium) have a lot of rows which might make it harder to see where your traffic is coming from at a glance.
One option you have is to view traffic not by Source/Medium but just by Medium. In this case we would only have 6 different values for Medium:
This is better but has some flaws. For example, referral would combine traffic from industry websites as well as generic social media like Facebook. These often have very different behaviour so you may want to split them. Your referral traffic might also fall under other buckets, for example your direct partners vs directories you are listed in vs random websites linking to you.
For this reason we normally recommend defining broad channels. You can think of these as buckets each containing one or more different traffic sources. You will want to customise them and segment them however you like.
Using Google Analytics (Universal Analytics) to define channels
By default Google already has a channel grouping with these channels:
This is very unlikely to be relevant to you without customisation. For example you might want to split Social Paid and Social Organic or even Paid Search Branded, Paid Search Unbranded and Paid Search Shopping, etc.
If you go to the GA admin area at the View level, you will see the list of channel groupings.
That red button looks pretty inviting right? It’s not what you think. Yes you can create your own groupings and they even apply retroactively. But they’re not much use outside of the GA interface. The only grouping that actually corresponds to a dimension available in the API (and hence exportable to other tools like Google Data Studio, Google Sheets etc) is this first one, the Default Channel Grouping. Unfortunately this grouping is NOT retroactive, so changing the definition does not affect old data. This is why it’s available as a dimension, since dimensions that can be exported are supposed to be set at the time the user visits the website.
For this reason we recommend customising this channel grouping as early as possible.
If you edit the default grouping you’ll see a bunch of rules. You can edit individual ones or drag them around to change the order.
The order matters because as soon as a new visit gets classified rules that are further below get ignored. Let’s say you have these 2 rules:
Rule 1: source = facebook and medium = cpc
Rule 2: source = facebook
Rule 2 would only fire for traffic that has not yet been classified earlier on (ie. if it failed rule 1). So in our case the rule is actually defining Facebook organic traffic, even though it wouldn’t work in isolation. This trick can make it easier to write rules that are not too complex.
The System Defined Channel is the Google Analytics default classification system. You can classify things yourself or you can mix and match. For example here, we’re defining Email as anything GA normally counts as email plus any traffic clicking from myemailsoftware.com:
You can also use the OR operator to string together separate sources, websites etc into a single bucket:
Using Google Analytics (GA4) to define channels
This is a short one, you can’t (at least not yet). GA4 has the same standard classification of traffic into channels as Universal Analytics. The only difference is that the name of the dimension is “Session default channel grouping” and you can’t edit the rules. You will need to use one of the methods below to implement your own.
Using Google Data Studio to define channels
While for Universal Analytics we recommend editing the Default Channel Grouping, these days for clients we normally define the channels in Google Data Studio.
The main advantage is that it’s backwards compatible: unlike GA if you edit the classification in GDS it will be applied retroactively. GA channels are pretty hard to manage since you need to monitor them for changes to your marketing mix and if you miss a change then traffic has already been misclassified.
You can do this for both Universal Analytics or GA4, in the example below we’re doing this for a Universal Analytics property but the principle is the same.
In your data source, create a new custom field and type in the formula, then use that custom field as the dimension in a chart. Here’s a sample one below:
Here’s the code for it (click to copy):
case when contains_text(Source / Medium, "sponsored") then "Facebook - Paid" when contains_text(Source / Medium, "facebook") then "Facebook - Organic" when contains_text(Source / Medium, "organic") then "SEO" when contains_text(Source / Medium, "ExactTarget") then "EDM" when contains_text(Source / Medium, "email") then "EDM" when contains_text(Source / Medium, "direct") then "Direct" when contains_text(Source / Medium, "linkedin") then "LinkedIn" else "Other" End
This is a very simple one because we’re just using the Source/Medium field as the input. But you can use other fields too, such as Landing Page, Campaign etc. Just don’t use metrics like Sessions or Pageviews or the formula will break.
Some useful links on GDS formulas for this:
- The CASE function to set up your classifications
- The REGEXP_MATCH function for more advanced text matching
Finally if you need to perform more complex working (eg. extracting a subfolder from a URL) you may want to define the smaller formula in a separate custom field and reference this custom field in your actual channel formula.
Using BigQuery to define channels
This is the most advanced use case but it’s very similar to Google Data Studio. It’s most appropriate for GA4 since it has the free BigQuery integration so you’ll be able to manipulate data at scale using SQL.
Your best bet is to take the query below and play around with it to modify it to your needs, however here’s a basic way we’re using Source/Medium again to create a simple classification and return the amount of traffic from each channel on a single day of data:
Here’s the code for it if you want to use this as the basis for playing around (click to copy).
SELECT CASE WHEN traffic_source.medium = "organic" THEN "SEO" WHEN traffic_source.medium = "(none)" THEN "Direct" WHEN traffic_source.medium = "email" THEN "Email" WHEN REGEXP_CONTAINS(traffic_source.source,"facebook") THEN "Facebook" ELSE "Other" END AS channel, COUNT (DISTINCT user_pseudo_id) AS users FROM `your-ga4-project-name.your-dataset-name.events_intraday_*` WHERE traffic_source.medium IS NOT NULL GROUP BY channel ORDER BY users desc
Below we have the output, which can be exported elsewhere (including automatically) or even piped straight into Google Data Studio:
Whichever way you implement it, having proper channel groupings will make it much easier to see your traffic at a glance, especially if you’re in a high campaign period, or your brand spans multiple stakeholders, teams or countries. A well-configured channels table showing traffic and conversions/revenue is one of the best starting places for any marketer to work out how things are going and what they should be doing next.
Got a question?
For something quick, the best place to ask would be on Twitter or in our Facebook group (you'll need to join the group but it’s a one-click process).