ai-referral-analysis
Measure traffic arriving from AI tools — ChatGPT, Claude, Perplexity, Gemini, Copilot, and others — and understand how it behaves…
GA4 has three distinct attribution scopes. Using the wrong scope gives misleading results. Choose based on the question you are answering.
$ npx -y skills add surendranb/google-analytics-mcp --skill attribution-scope --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/attribution-scopeContext preview
The summary Claude sees to decide when to auto-load this skill.
GA4 has three distinct attribution scopes. Using the wrong scope gives misleading results. Choose based on the question you are answering.
name: attribution-scope description: "GA4 has three distinct attribution scopes. Using the wrong scope gives misleading results. Choose based on the question you are answering."
GA4 has three distinct attribution scopes. Using the wrong scope gives misleading results. Choose based on the question you are answering.
| 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 |
**Session scope** — use for traffic analysis:
**First-user scope** — use for acquisition analysis:
**Event/attribution scope** — use only in advertising/conversion contexts:
**"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.)
A user acquired via Instagram who later converts via Google Organic will show:
These are different questions. Mixing scopes in one query produces meaningless results. Never combine `sessionSource` with `firstUserMedium` in the same report.
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"}}}Model Context Protocol (MCP) server for Google Analytics 4: real-time query exploration, schema discovery, metric aggregation, and audience insights for AI agents. 🌐 Live Documentation & Web Portal:
Measure traffic arriving from AI tools — ChatGPT, Claude, Perplexity, Gemini, Copilot, and others — and understand how it behaves…
Identify and exclude bot, scraper, and spam sessions from GA4 data.
Break down sessions and users by traffic source, medium, and channel group to understand where your audience comes from and which…
The correct GA4 Data API names for fields models most often get wrong. Use these before calling `get_ga4_data` — wrong names…
GA4 enforces strict rules about which dimensions and metrics can appear in the same request. Incompatible combinations return a…
Identify top-performing pages, find underperforming content, and understand engagement patterns across your site.