agentleFS
surendranbsurendranb/google-analytics-mcp/skills/attribution-scope/SKILL.md

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
  1. Very specific:

    Never combine sessionSource with firstUserMedium in the same report.

    line 62
  2. Distinctive:

    When filtering, use the same scope as your dimensions:

    line 66

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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

ScopeDimension prefixQuestion it answersWhen to use
SessionsessionWhere did THIS session come from?Traffic Acquisition — volume, engagement, conversions by source
First-userfirstUserWhich 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:

  • sessionDefaultChannelGroup
  • sessionSource
  • sessionMedium
  • sessionCampaignName
  • sessionSourceMedium

First-user scope — use for acquisition analysis:

  • firstUserDefaultChannelGroup
  • firstUserSource
  • firstUserMedium
  • firstUserCampaignName

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"}}}

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.