attribution-scope
Skill244 starsChanged 43 days agoMITView on GitHub
GA4 has three distinct attribution scopes. Using the wrong scope gives misleading results. Choose based on the question you are answering.
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 62
Never combine sessionSource with firstUserMedium in the same report.
- Distinctive: line 66
When filtering, use the same scope as your dimensions:
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Attribution Scope
GA4 has three distinct attribution scopes. Using the wrong scope gives misleading results. Choose based on the question you are answering.
The three scopes
| Scope | Dimension prefix | Question it answers | When to use |
| Session | session | Where did THIS session come from? | Traffic Acquisition — volume, engagement, conversions by source |
| First-user | firstUser | Which channel originally acquired this user? | User Acquisition — who brought in new users |
| Event/attribution | (no prefix) | Which channel gets credit for this conversion? | Advertising reports — AI-weighted conversion credit allocation |
Dimensions by scope
Session scope — use for traffic analysis:
sessionDefaultChannelGroupsessionSourcesessionMediumsessionCampaignNamesessionSourceMedium
First-user scope — use for acquisition analysis:
firstUserDefaultChannelGroupfirstUserSourcefirstUserMediumfirstUserCampaignName
Event/attribution scope — use only in advertising/conversion contexts:
defaultChannelGroup(no prefix)source(no prefix)medium(no prefix)
How to choose
"Where is my traffic coming from?" → session scope
dimensions: ["sessionDefaultChannelGroup", "sessionSource", "sessionMedium"]
metrics: ["sessions", "totalUsers", "engagedSessions", "keyEvents"]"Which channels are bringing in new users?" → first-user scope
dimensions: ["firstUserDefaultChannelGroup", "firstUserSource"]
metrics: ["newUsers", "totalUsers"]"How should I attribute conversion credit across channels?" → event scope (Use only with advertising campaign analysis; this is AI-weighted attribution.)
Common mistake
A user acquired via Instagram who later converts via Google Organic will show:
sessionDefaultChannelGroup = "Organic Search"(where this session came from)firstUserDefaultChannelGroup = "Organic Social"(where they were first acquired)
These are different questions. Mixing scopes in one query produces meaningless results.
Never combine sessionSource with firstUserMedium in the same report.
Nested filters
When filtering, use the same scope as your dimensions:
// Filtering traffic acquisition report — use session-scoped dimension
{"filter": {"fieldName": "sessionDefaultChannelGroup", "stringFilter": {"value": "Organic Search", "matchType": "EXACT"}}}
// NOT source (attribution scope) — wrong scope for this report
{"filter": {"fieldName": "source", "stringFilter": {"value": "google", "matchType": "EXACT"}}}In this repository21 other files it gives its agents.
- AGENTS.mdAGENTS.md
- docs/llms-full.txtllms.txt
- docs/llms.txtllms.txt
- llms.txtllms.txt
- ga4-analyticsSkill
- ai-referral-analysisSkill
- bot-traffic-detectionSkill
- channel-acquisitionSkill
- common-metric-namesSkill
- compatible-combinationsSkill
- content-performanceSkill
- custom-dimensionsSkill
- date-rangesSkill
- ecommerce-analysisSkill
- filter-structuresSkill
- ga4-limitationsSkill
- gcp-setupSkill
- geo-device-segmentationSkill
- gcp-setupSkill
- traffic-diagnosisSkill
- ua-to-ga4Skill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

