attribution-scope

attribution-scope is a skill for Claude Code, Codex from surendranb/google-analytics-mcp. It costs 30 tokens per session (636 once invoked), scanned A, original, MIT.

A guide to the three ways Google Analytics 4 (GA4) assigns traffic and conversion credit: the current visit, the user's first visit, or a conversion event. Each answers a different question about where users came from.

In plain words
What is it for?
Use it when querying GA4 for traffic sources, new-user acquisition, or conversion credit, and when choosing the correct source, medium, campaign, or channel fields.
Why use it?
It prevents reports from using a traffic source scope that does not match the question being asked. That avoids misleading conclusions about acquisition, sessions, or advertising results.

Skill for Claude CodeCodex

Part of the google-analytics-mcp plugin — 16 skills, 1 MCP server shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/surendranb/google-analytics-mcp/attribution-scope
Any agent
npx skills add surendranb/google-analytics-mcp --skill attribution-scope
Clone the repo
git clone --depth 1 https://github.com/surendranb/google-analytics-mcp

Made for: Claude Code, Codex.

Or install google-analytics-mcp, the plugin that ships this one along with the rest of its 16 skills, 1 MCP server.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for attribution-scope

README.md
[![agentmods](https://agentmods.dev/badge/skills/surendranb/google-analytics-mcp/attribution-scope.svg)](https://agentmods.dev/skills/surendranb/google-analytics-mcp/attribution-scope)
Your own site
<a href="https://agentmods.dev/skills/surendranb/google-analytics-mcp/attribution-scope"><img src="https://agentmods.dev/badge/skills/surendranb/google-analytics-mcp/attribution-scope.svg" alt="Measured on agentmods" height="20"></a>
Per session 30 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 636 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00030 $0.00636
Opus 5 $0.00015 $0.00318
Sonnet 5 $0.00006 $0.00127
Haiku 4.5 $0.00003 $0.00064

Measured 6d ago against content hash 34ecebaa4f2c, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

attribution-scope scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/attribution-scope/SKILL.md · 74 lines

How it starts

The opening of the file, as written. The whole thing — 74 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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:

  • 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)

Read the full file on GitHub · 74 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 74 lines · 30 tokens per session scan A 34ecebaa4f2c

Subscribe to this mod's changes

attribution-scope is a skill published in the GitHub repository surendranb/google-analytics-mcp (241 stars, last pushed 3d ago), licensed MIT. It adds 30 tokens to every session and 636 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.