Sub topic 13
Building a custom channel group
This chapter assumes you know how GA4 builds the default channel group from source, medium and campaign. It also assumes you can read the Traffic acquisition report. The goal here is to build your own grouping when the default one does not match how your business thinks about traffic.
When the default grouping is not enough
The default channel group is a fixed set of rules that Google maintains. You cannot edit it. That is usually fine, but some cases need a different view:
- You run affiliate links and want them separate from general Referral traffic.
- You want branded and non-branded paid search shown as different channels.
- Several of your own domains or partner sites send traffic that the default rules treat as Referral.
- Your team uses campaign naming conventions, such as a
cmp_prefix for partnerships, that do not map to any default channel. - You want fewer, broader channels for an executive report.
A custom channel group is a property-level definition that reclassifies traffic using the same dimensions the default group uses. It does not change the data GA4 collects. It only changes how that data is labelled when you read it.
How custom channel groups work
A custom channel group is an ordered list of channels. Each channel has a name and one or more conditions. GA4 checks a session's values against the channels from top to bottom. The first channel whose conditions match wins, and later channels are not checked. A session that matches no channel goes to an Unassigned bucket in your custom group.
This is the same first-match-wins logic as the default rules, so order matters. A broad rule placed above a narrow one swallows the traffic the narrow one was meant to catch.
Retroactive and reporting-time
Channel groups are applied when you run a report, not when the data is collected. Two things follow from this:
- A new custom group applies to historical data, as far back as your report date range goes.
- Editing a group changes how past data appears. The raw source, medium and campaign values stay the same.
This differs from a custom event or custom dimension, which only collects data from the moment you create it. It also means you can try a grouping without risk. You can delete or edit the group and nothing is lost.
Planning the group before you build it
Write the design down first. A short table avoids most ordering mistakes.
| Order | Channel name | Condition idea |
|---|---|---|
| 1 | Affiliates | Medium exactly matches `affiliate` |
| 2 | Partnerships | Campaign begins with `cmp_` |
| 3 | Brand Paid Search | Default channel group is Paid Search and campaign contains `brand` |
| 4 | Other Paid Search | Default channel group is Paid Search |
| 5 | Everything else | Default channel group matches regex `.*` |
Three design rules help:
- Put the most specific channels first and the most general last.
- Build on the default channel group where you can. A condition such as "Default channel group exactly matches Paid Search" reuses Google's rules, including its source list, so you do not have to maintain your own.
- Decide what should happen to leftovers. Either add a final catch-all channel or accept an
Unassignedbucket. An explicit catch-all is easier to audit, but it hides traffic you have not planned for.
Creating the group in GA4
You need the Editor role on the property to do this.
- Open Admin, then under Data display choose Channel groups.
- Select Create new channel group. You can start from a copy of the default group or from scratch. Copying the default group is the safer choice because it keeps the standard rules and you change only what you need.
- Name the group, for example
Marketing team channels. - Add or edit channels. For each channel, set a name and add conditions. Each condition picks a dimension, a match type and a value.
- Reorder channels by dragging them. Check the order against your plan.
- Save the group.
Useful dimensions for conditions include Source, Medium, Source / medium, Campaign, Source platform and Default channel group. Match types include exactly matches, contains, begins with, ends with, and regular expression options. When several conditions sit in one channel, you can combine them with AND or OR. Test regular expressions before you save them, because a pattern that is too loose is a common source of wrong labels.
A rule model you can run
Custom groups are configured in the interface, but their logic is easy to test offline. The sketch below models ordered, first-match-wins evaluation with a few channels. It is a simplified model for learning, not GA4's engine.
import re
# Each rule: (channel name, predicate on the session dictionary)
RULES = [
("Affiliates", lambda s: s["medium"] == "affiliate"),
("Partnerships", lambda s: s["campaign"].startswith("cmp_")),
("Brand Paid Search",
lambda s: s["default_channel"] == "Paid Search" and "brand" in s["campaign"]),
("Other Paid Search", lambda s: s["default_channel"] == "Paid Search"),
("Everything else", lambda s: re.fullmatch(r".*", s["default_channel"]) is not None),
]
def custom_channel(session):
for name, matches in RULES:
if matches(session):
return name
return "Unassigned"
sessions = [
{"medium": "affiliate", "campaign": "spring", "default_channel": "Referral"},
{"medium": "cpc", "campaign": "brand_core", "default_channel": "Paid Search"},
{"medium": "cpc", "campaign": "generic_shoes", "default_channel": "Paid Search"},
{"medium": "email", "campaign": "cmp_launch", "default_channel": "Email"},
{"medium": "organic", "campaign": "(organic)", "default_channel": "Organic Search"},
]
for s in sessions:
print(s["medium"], "->", custom_channel(s))The output is:
affiliate -> Affiliates
cpc -> Brand Paid Search
cpc -> Other Paid Search
email -> Partnerships
organic -> Everything elseThe fourth session shows why order matters. It is an email send, but its campaign begins with cmp_, so the Partnerships rule catches it before any email rule could. If you want that traffic to stay in Email, move a rule for it above Partnerships or narrow the Partnerships condition.
Using the group in reports
After you save a group, it becomes available as a dimension, in three scopes that mirror the default group.
- Session scope labels each session by how that session arrived. Use this for channel performance questions such as "which channel drove purchases this month".
- First-user scope labels each user by the channel that first brought them to your property. Use this for acquisition questions such as "which channel brings in users who come back".
- Event scope labels each event by the traffic source attached to that event. It matters mostly for attributing key events and is the least commonly needed.
In Explorations you can add these dimensions to a free-form table and compare your custom grouping with the default one side by side. That is the quickest way to check that your rules behave as planned. In the standard Traffic acquisition report, you can switch the report's primary channel group to your custom group.
Common mistakes
- Wrong order. A general rule above a specific one. Fix by dragging the specific rule up.
- Case and spelling. Values such as
Affiliateandaffiliatecan both appear in your data if your tagging is inconsistent. GA4 source and medium values are lower-cased in many cases, but do not rely on that. Use a match type or regular expression that tolerates variants. - Over-wide contains conditions. A condition such as campaign contains
salealso catcheswholesale. Use begins with, or anchor a regular expression. - Expecting new values to fix old tagging. A custom group relabels what was recorded. It cannot repair a missing
utm_mediumor recover traffic that was already recorded as Direct. - Treating a custom group as the only truth. Other people read the default group. If you present custom numbers, say which group they come from.
- Data outside the interface. Check whether your export or API route supports custom channel groups before you plan a pipeline around one. In particular, do not assume the raw BigQuery event export carries your custom labels. If you need the grouping there, recreate the rules in SQL.
Maintaining the group
Treat the group like configuration code. Keep the design table where your team can see it. When marketing adds a new campaign naming pattern or a new partner, update the table and the group together. Review the Unassigned bucket periodically. A growing Unassigned count means traffic is arriving with values your rules do not cover.
Exercise
Your custom channel group has these channels in order: (1) Other Paid Search, with the condition "Default channel group exactly matches Paid Search"; (2) Brand Paid Search, with the conditions "Default channel group exactly matches Paid Search" AND "Campaign contains brand". After you save it, Brand Paid Search shows zero sessions. Why, and what is the fix?
Show answer
GA4 evaluates channels from top to bottom and stops at the first match. Every brand paid search session also matches the broader Other Paid Search rule at position 1, so it is labelled there and never reaches Brand Paid Search. Move Brand Paid Search above Other Paid Search so the specific rule is checked first.
Exercise
You create a custom channel group today and open a report covering the last six months. Will the older sessions use your new channel names? Does the change also alter the source and medium values stored for those sessions?
Show answer
Yes, the older sessions will appear under your new channel names, because channel groups are applied at reporting time. No, the stored source, medium and campaign values do not change. Only the label that groups them changes.