What it does
Sessions by channel tell you who showed up. Whether they did anything is a separate question, and since GA4 renamed conversions to key events in 2024 the answer sits under a new name in Traffic acquisition, next to a rate column that is easy to misread. The agent pulls both for each default channel group every Monday.
What a marketer notices first is usually a mismatch: a channel with a fifth of the sessions and a tenth of the key events, or email quietly converting at twice the site rate.
How it works
1List what counts as a key event
Read the property's key events once with the Admin API (
properties.keyEvents.list) so the report can name them, for examplesign_up,generate_leadandpurchase.2Pull key events by channel
Call
runReportfor the last 7 full days and the 7 before, withdimensions: [{ name: "sessionDefaultChannelGroup" }]and the metricssessions,keyEventsandsessionKeyEventRate. To follow one conversion only, usekeyEvents:sign_upandsessionKeyEventRate:sign_upinstead.- 3
3Compare shares and rates
Set each channel's share of sessions next to its share of key events, and compare its rate with last week. Flag channels whose rate moved 20% or more and that had at least 30 key events in either week.
- 4
4Post the tile
Total key events is the headline with 8 weeks of history, the glance shows key events per channel, and the opened card has the full table with a line on the biggest mismatch.
Post it to the board
With
BRIEFKIN_TOKENset, the agent sends the result as one card that updates in place every run. Without it, you get the report in the chat.
Install and run it
Pick your agent, where the data comes from and how to schedule it; the commands below follow.
Install the skill
One command. It puts the SKILL.md in ~/.claude/skills and in ~/.agents/skills, which Codex, Cursor, Gemini CLI, Copilot CLI and OpenCode read too.
shell
curl -fsSL https://briefkin.dev/skills/google-analytics-key-events-by-channel/install | shRun it
Ask Claude Code:
prompt
Run the google-analytics-key-events-by-channel skillOr paste the prompt instead of installing:
prompt
Using the GA4 Data API, report key events by sessionDefaultChannelGroup for the last 7 full days and the 7 days before. For each channel give sessions, keyEvents and sessionKeyEventRate, plus the change in rate. Show each channel's share of sessions next to its share of key events and call out the biggest mismatches. Flag rate changes of 20% or more where the channel had at least 30 key events. Start with total key events and its change, and end with one suggestion on where to put more effort.Put it on a schedule
Mondays at 9:30, from cron on any machine where Claude Code is signed in:
crontab
30 9 * * 1 claude -p "Run the google-analytics-key-events-by-channel skill"Add it with
crontab -e. A laptop asleep at that time runs it when it wakes if you use launchd or Task Scheduler instead; GitHub Actions works for the API route.Send it to your board
Connect Briefkin once with
curl -fsSL https://briefkin.dev/install | shand every run lands on your board as a stat tile. How setup works
View the SKILL.mdRaw file
SKILL.md---
name: google-analytics-key-events-by-channel
description: "Every Monday, key events and session key event rate for each GA4 default channel group, so you see which channels convert and which only bring visits. Use when the user asks for this, or when it runs on a schedule."
---
# GA4 conversions by channel
Every Monday, key events and session key event rate for each GA4 default channel group, so you see which channels convert and which only bring visits.
Sessions by channel tell you who showed up. Whether they did anything is a separate question, and since GA4 renamed conversions to key events in 2024 the answer sits under a new name in Traffic acquisition, next to a rate column that is easy to misread. The agent pulls both for each default channel group every Monday.
What a marketer notices first is usually a mismatch: a channel with a fifth of the sessions and a tenth of the key events, or email quietly converting at twice the site rate.
## Two ways to get the data
Use the API or MCP route when you have an MCP server, a CLI or an API token for the app. Otherwise, if you can drive a browser the user is signed in to (Claude in Chrome, a Playwright or Chrome DevTools MCP server), use the browser route. Say which one you used.
## Route A: API or MCP server
### What you need
- The Viewer role on the GA4 property; reading key event settings through the Admin API needs no more than that.
- The Analytics Data and Admin APIs, reached through an Analytics MCP server or connector, or a service account with the `analytics.readonly` scope.
If something is missing, say what and stop; do not invent numbers.
### Steps
1. **List what counts as a key event** (Google Analytics): Read the property's key events once with the Admin API (`properties.keyEvents.list`) so the report can name them, for example `sign_up`, `generate_lead` and `purchase`.
2. **Pull key events by channel** (Google Analytics): Call `runReport` for the last 7 full days and the 7 before, with `dimensions: [{ name: "sessionDefaultChannelGroup" }]` and the metrics `sessions`, `keyEvents` and `sessionKeyEventRate`. To follow one conversion only, use `keyEvents:sign_up` and `sessionKeyEventRate:sign_up` instead.
3. **Compare shares and rates**: Set each channel's share of sessions next to its share of key events, and compare its rate with last week. Flag channels whose rate moved 20% or more and that had at least 30 key events in either week.
4. **Post the tile**: Total key events is the headline with 8 weeks of history, the glance shows key events per channel, and the opened card has the full table with a line on the biggest mismatch.
## Route B: the browser
### What you need
- Signed in to Google with the Viewer role on the GA4 property; the Key events admin page is readable with Viewer access.
If something is missing, say what and stop; do not invent numbers.
### Steps
Start at https://analytics.google.com/analytics/web/. The user is signed in already; never type passwords or codes, and ask if a sign-in page appears.
1. **See which events count**: Pick the property, open Admin > Data display > Key events and note the names marked as key events, for example `sign_up`, `generate_lead`, `purchase`.
2. **Open Traffic acquisition with the comparison**: Go to Reports > Acquisition > Traffic acquisition, set the date range to `Last 7 days`, switch on Compare with `Previous period (match day of week)` and Apply. The primary dimension should be `Session default channel group`.
3. **Read key events and the rate per channel**: The table already has Sessions, Key events and Session key event rate columns. The dropdown in the Key events column header switches from All events to one event, for example `sign_up`, and the rate column follows it.
4. **Compare shares and rate changes**: For each channel, set its share of total sessions next to its share of total key events (the Totals row gives both). Flag channels whose rate moved 20% or more and that had at least 30 key events in either week.
5. **Write it up**: Total key events and the change first, then the channel table, then the biggest mismatch and one suggestion on where to shift effort.
Note: Session key event rate is the share of sessions with at least one key event, so it is always lower than key events divided by sessions. The comparison columns the report draws make this a good fit for the browser route.
## The report
- **Key events** last week, with an 8-week trend and the change on the week before.
- **By channel**: sessions, key events and session key event rate, with the change in rate.
- **Mismatches**: channels with a much bigger share of sessions than of key events, or the reverse.
- One line on where to shift effort, for example "Email converts at 7.2%, twice the site rate: send the launch sequence to more of the list".
## Post it to Briefkin
When `BRIEFKIN_TOKEN` is set, or `~/.config/briefkin/env` exists (the installer from https://briefkin.dev/docs writes it), also send the result to the user's Briefkin board as one card. Keep the `item_key` the same on every run so the card updates in place, use a new `event_id` per run, and put today's real numbers in place of the example ones. If the request fails, say so once and carry on.
```bash
[ -n "${BRIEFKIN_TOKEN:-}" ] || . ~/.config/briefkin/env
curl -sS -X POST "${BRIEFKIN_URL:-https://briefkin.dev}/v1/events" \
-H "authorization: Bearer $BRIEFKIN_TOKEN" \
-H "content-type: application/json" \
-d @- <<'JSON'
{
"v": 1,
"event_id": "google-analytics-key-events-by-channel/<date of this run, e.g. 2026-10-16>",
"item_key": "google-analytics-key-events-by-channel",
"project": "example.com",
"source": "GA4 conversions by channel skill",
"kind": "metric",
"title": "Key events up 8% on last week",
"metric": {
"label": "Key events",
"value": 1136,
"better": "higher",
"period_start": "<start of the period, ISO 8601>",
"period_end": "<end of the period, ISO 8601>"
},
"glance": [
{
"type": "Grid",
"props": {
"columns": 2
},
"children": [
{
"type": "Stat",
"props": {
"label": "Session key event rate",
"value": 3.6,
"unit": "%",
"delta": 4
}
},
{
"type": "Stat",
"props": {
"label": "Best channel",
"value": "Email, 7.2%"
}
}
]
},
{
"type": "Bars",
"props": {
"items": [
{
"label": "Organic Search",
"value": 402
},
{
"label": "Paid Search",
"value": 268
},
{
"label": "Direct",
"value": 236
},
{
"label": "Email",
"value": 151
},
{
"label": "Referral",
"value": 58
},
{
"label": "Organic Social",
"value": 21
}
]
}
}
],
"widget": [
{
"type": "Table",
"props": {
"columns": [
"Channel",
"Sessions",
"Key events",
"Rate",
"Rate change"
],
"align": [
"left",
"right",
"right",
"right",
"right"
],
"rows": [
[
"Organic Search",
12480,
402,
"2.9%",
"+4%"
],
[
"Paid Search",
4320,
268,
"5.6%",
"-3%"
],
[
"Direct",
6210,
236,
"3.4%",
"+2%"
],
[
"Email",
1880,
151,
"7.2%",
"+18%"
],
[
"Referral",
2150,
58,
"2.4%",
"-9%"
],
[
"Organic Social",
1600,
21,
"1.2%",
"-25%"
],
[
"All channels",
28640,
1136,
"3.6%",
"+4%"
]
]
}
},
{
"type": "Callout",
"props": {
"text": "Email brings 7% of sessions and 13% of key events. Organic Social brings 6% of sessions and 2% of key events.",
"tone": "info"
}
}
],
"size": "md"
}
JSON
```
Widgets come from the Briefkin catalog (https://briefkin.dev/v1/catalog). Without a token, just give the user the report.
Set `period_start` and `period_end` to the window the number covers: the tile names it from them ("Last 7 days", "Today", "This month"). For a count right now (open items, a balance), send `"period_label": ""` so no period shows; for another name, send it as `period_label` (at most 24 characters).
## Run it on a schedule
Suggested: Mondays at 9:30 (`30 9 * * 1`). From cron, with the agent signed in on that machine:
```bash
30 9 * * 1 claude -p "Run the google-analytics-key-events-by-channel skill"
# Codex: codex exec, Gemini CLI: gemini -p, Copilot CLI: copilot -p, OpenCode: opencode run
```
Or use the agent's own scheduler (Claude Code routines, Codex automations, Claude or ChatGPT scheduled tasks): https://briefkin.dev/skills/google-analytics-key-events-by-channel#schedule
Source: https://briefkin.dev/skills/google-analytics-key-events-by-channel
What your agent needs
The Viewer role on the GA4 property; reading key event settings through the Admin API needs no more than that.
The Analytics Data and Admin APIs, reached through an Analytics MCP server or connector, or a service account with the
analytics.readonlyscope.
Connecting Google Analytics
- Google Analytics MCP server, Google's own open-source server (
analytics-mcpon PyPI, source). It runs locally withpipx run analytics-mcp, offersrun_report,run_realtime_reportandget_account_summaries, and Google labels it experimental. - Data API with a service account. Enable the Google Analytics Data API in a Google Cloud project, create a service account, add its email as a Viewer on the GA4 property, and point
GOOGLE_APPLICATION_CREDENTIALSat its JSON key. The skill also readsGA4_PROPERTY_ID. - Your own Google login.
gcloud auth application-default login --scopes https://www.googleapis.com/auth/analytics.readonly,https://www.googleapis.com/auth/cloud-platform --client-id-file=client.jsongives the MCP server or a script your user's access without a key file.
Request only analytics.readonly and keep the service account at Viewer: none of these reports needs Editor.
Questions
Why is the rate lower than key events divided by sessions?
sessionKeyEventRate is the share of sessions with at least one key event. A session that signs up and then books a demo counts twice in keyEvents but once in the rate, so the rate is always the smaller number.
Should these match the conversions in Google Ads?
No. GA4 credits the key event to the session's channel with its own attribution, and Google Ads counts conversions by click date with its own settings. Use this report to compare channels with each other, and Google Ads for bidding decisions.
Do I need Briefkin to use the GA4 conversions by channel skill?
No. The skill runs with your own agent and gives you the report in the chat. With a Briefkin token set, each run also posts it to your board as a stat tile, so you can glance at it instead of asking again.
Which agents can run it?
Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot CLI, OpenCode, Windsurf and Amp all read SKILL.md files. The install command puts it in ~/.claude/skills and ~/.agents/skills, where they look. ChatGPT, the Claude app and Grok take the prompt instead. Pick your agent under "Install and run it" and the commands change to match.
Can it work without an API or MCP server, from my browser?
Yes. Switch the data source to "Your browser" and the steps change to the Google Analytics pages themselves: the agent opens analytics.google.com/analytics/web in a browser you are signed in to and reads the numbers off the page. Claude Code, Codex, Cursor, Claude app and ChatGPT can drive a browser out of the box; Gemini CLI, Copilot CLI and OpenCode need a Playwright or Chrome DevTools MCP server first. It is slower than the API and needs you signed in, so it suits a report you run by hand or from a scheduler on your own computer.