Sub topic 6
Creating an AI Assistants channel group
This chapter assumes you can navigate GA4 reports and know what a referrer and a UTM parameter are. You also need access to the property. Editor access is enough to read the reports. Administrator access is required to create a custom channel group in the property's data settings.
By the end you will have a custom channel group that separates AI assistant traffic from Referral and Direct. You will also know why rule order matters, how the regex works, and which mistakes cause the group to stay empty.
What a channel group is
A channel group is a set of rules that sorts each session or user into a named bucket, such as Organic Search, Paid Social, or Referral. GA4 ships with a default channel group. It has no AI category, so a visit from chatgpt.com is usually classified as Referral. The default group also contains rules that match on medium or source names. If an AI platform sends a visit with a UTM medium of organic or social, the visit can land in an unrelated channel.
A custom channel group lets you write your own rules. Each rule has a channel name and one or more conditions on dimensions such as Source, Medium, or Source platform. GA4 checks the rules from top to bottom and assigns the first one that matches. Everything that matches no rule goes to "Unassigned".
Custom groups apply to reports, not to stored data
Keep these facts in mind before you build anything:
- A custom channel group is a reporting layer. It does not change the data GA4 collected.
- It applies to historical data too. Once you create it, past sessions are reclassified in reports that use the group.
- It does not alter the default channel group. The default group still shows those visits as Referral.
- It is not available in the BigQuery export. The export holds raw source, medium, and referrer values, so you repeat the logic in SQL (see the BigQuery chapter).
The matching pattern
You already found the AI hostnames in your own data in the previous chapter. This regular expression matches the common ones:
.*(chatgpt\.com|chat\.openai\.com|gemini\.google\.com|perplexity\.ai|copilot\.microsoft\.com|claude\.ai).*The pieces work like this:
.*at each end allows any text before or after the hostname.- The parentheses group the alternatives, and
|means "or". \.matches a literal dot. An unescaped.matches any character, sochatgptxcomwould match.
GA4's "matches regex" operator requires the pattern to match the whole value. That is why the leading and trailing .* are needed. Without them, a source of perplexity.ai could still match, but www.perplexity.ai would not.
Steps to create the group
- Open Admin and, under Data display, choose Channel groups.
- Choose Create new channel group. You can also copy the default group first. Copying keeps all the standard channels, so you only add one.
- Name the group, for example
Default + AI Assistants. - Add a new channel and name it
AI Assistants. - Add a condition: dimension Source, operator matches regex, value set to the pattern above.
- Drag the new channel above Referral in the list.
- Save the group.
If you did not copy the default, add the other channels you need yourself. Anything you leave out goes to Unassigned, which makes the group less useful than the default one.
Choosing the condition
Source is the usual dimension, but you can build stronger rules by combining conditions in one channel. Within a single channel, conditions combine with AND by default, and you can add an OR group.
| Approach | Condition | Strength | Weakness |
|---|---|---|---|
| Source regex | Source matches regex AI hostnames | Simple and covers most referral traffic | Misses visits whose source is not a hostname |
| Medium or UTM | Medium exactly matches a value you control, such as `ai-assistant` | Reliable for links you tag yourself | Only works for URLs you or a partner tag |
| Source and Medium together | Source regex OR Medium equals your value | Catches both untagged and tagged visits | Slightly longer to maintain |
Some assistants append their own UTM parameters. For example, a link opened from ChatGPT can carry utm_source=chatgpt.com. In that case GA4 records the source as chatgpt.com and the medium from the parameter, which can be absent. Check the Source values you actually see rather than assuming the format. The earlier chapter on finding sources shows how.
A worked example
Suppose a property has these session sources in a week:
| Source / medium | Sessions |
|---|---|
| google / organic | 1,200 |
| chatgpt.com / referral | 40 |
| perplexity.ai / referral | 12 |
| gemini.google.com / referral | 9 |
| news.example.org / referral | 25 |
| (direct) / (none) | 300 |
With the default group, the three AI rows are folded into Referral, which shows 86 sessions. With your custom group and the AI rule above Referral, the result is:
| Channel | Sessions |
|---|---|
| Organic Search | 1,200 |
| Direct | 300 |
| Referral | 25 |
| AI Assistants | 61 |
The 61 comes from 40 + 12 + 9. The 25 left in Referral is the news site. The totals stay the same. Only the grouping changes.
Note that gemini.google.com contains google.com. Some default rules for Organic Search match on source names such as google, but they also require the medium to be organic. A Gemini referral has the medium referral, so it does not match those rules. Putting the AI rule first removes the doubt anyway.
Using the new channel group in reports
A custom channel group does not replace the default one in the standard acquisition reports. To see it:
- Open Reports, then Acquisition, then Traffic acquisition.
- Click the dimension drop-down above the first column.
- Under Session, look for your group name, such as
Session Default + AI Assistants. Custom groups are listed with the same prefix as other session-scoped dimensions. - Select it. The rows now show your channels.
In Explore, add the custom group from the Dimensions list in the Variables column, then drag it to Rows. The next chapter covers explorations in more detail.
A custom group exists in three scopes in some interfaces: session, first user, and last click. Use the session-scoped version for traffic questions and the user-scoped version only when you study how people first arrived.
Common errors
- Zero sessions in the channel. The rule is below Referral, or the regex contains an unescaped character that never matches. Test the pattern against a real Source value from your data.
- The default report still shows Referral. You looked at the default dimension. Switch to the custom group in the drop-down.
- A new group shows no data right away. Group changes can take some time to appear. Check again later before changing the rules.
- A dot or a missing wildcard.
chatgpt.comwithout escaping matches more than intended. Without.*at the ends,matches regexmay fail on values with awww.prefix. - Over-matching. A pattern such as
.*claude.*could capture unrelated sources whose names contain those letters. Keep full hostnames in the pattern. - Assuming the group catches everything. It only sees visits that carry a referrer or UTM. AI visits that arrive with no referrer still appear under Direct. The chapter on missing referrers covers that, and the custom event chapter offers a partial answer.
Maintaining the group
AI platforms change hostnames, add apps, and open links in different ways. Treat the regex as a list you review. A short routine helps:
- Every month, open Traffic acquisition with the dimension Session source / medium.
- Filter to Referral and sort by sessions.
- Look for new hostnames that belong to an AI assistant.
- Add them to the regex and save.
Record each change and its date in your annotations or documentation. Because the group applies to history, adding a hostname also reclassifies earlier sessions from that hostname, which can shift past totals. Note the change so that people comparing reports understand why numbers moved.
Checking your result
You can verify the group with a controlled visit. Open a page of your site from a link in an assistant, then look at Realtime. The next chapters on reports and validation cover the full procedure. For now, a quick check is enough: after the group has had time to process, open Traffic acquisition with your custom dimension and confirm that AI Assistants shows sessions that match the AI rows in Session source / medium.
Exercise
A colleague built a custom channel group with an AI Assistants rule using the regex .*(chatgpt\.com|perplexity\.ai).*. The rule is placed below Referral, and the channel shows 0 sessions although the Session source / medium report lists chatgpt.com / referral with 40 sessions. What is wrong, and how do you fix it?
Show answer
GA4 evaluates channel rules from top to bottom and assigns the first match. The chatgpt.com / referral sessions match the Referral rule first, so they never reach the AI Assistants rule. Drag the AI Assistants channel above Referral and save the group. The regex itself is valid.
Exercise
Explain why the leading and trailing .* are included in the pattern, and what happens to a source of www.perplexity.ai if you remove them and use the pattern (perplexity\.ai).
Show answer
The "matches regex" operator must match the whole Source value. With (perplexity\.ai) alone, only a value that is exactly perplexity.ai matches. www.perplexity.ai has extra text in front, so it fails and the session falls through to Referral. Adding .* at both ends allows any text around the hostname.
Exercise
After you create the custom channel group, does it change the data stored in BigQuery or in the default Traffic acquisition report? Name where you must repeat the logic.
Show answer
No. A custom channel group is applied only in GA4 reporting and Explore, including past data in those views. It does not change the default channel group and it is not present in the BigQuery export. To classify AI traffic in BigQuery, repeat the matching logic in SQL, for example with REGEXP_CONTAINS on the page referrer or source.