ai-referral-analysis
How to track and measure traffic from ChatGPT, Claude, Perplexity, and Gemini in GA4. Exact dimension filters, regex patterns,…
Which dimensions and metrics can be queried together in GA4 without triggering incompatible scope errors. Matrix of user, session, and event-level pairings.
Claude Code
$ npx -y skills add surendranb/google-analytics-mcp --skill compatible-combinations --agent claude-code
Codex
$ npx skills add surendranb/google-analytics-mcp --skill compatible-combinations -a codex -y
Cursor
$ npx skills add surendranb/google-analytics-mcp --skill compatible-combinations -a cursor -y
Gemini CLI
$ npx skills add surendranb/google-analytics-mcp --skill compatible-combinations -a gemini-cli -y
GitHub Copilot
$ npx skills add surendranb/google-analytics-mcp --skill compatible-combinations -a github-copilot -y
OpenCode
$ npx skills add surendranb/google-analytics-mcp --skill compatible-combinations -a opencode -y
Windsurf
$ npx skills add surendranb/google-analytics-mcp --skill compatible-combinations -a windsurf -y
name: compatible-combinations titleTag: "GA4 Compatible Dimensions & Metrics (Avoid 400s)" description: "Which dimensions and metrics can be queried together in GA4 without triggering incompatible scope errors. Matrix of user, session, and event-level pairings."
Google Analytics 4 enforces strict scoping boundaries. Attempting to query dimensions and metrics with conflicting scopes causes the API to return a 400 error: `The request's dimensions & metrics are incompatible.`
This reference outlines which field pairings are valid across event, session, and user scopes.
All data in GA4 is partitioned into three hierarchical scopes:
| Scope Level | Description | Key Dimensions | Key Metrics | |---|---|---|---| | **Event Scope** | Actions taken at a specific moment | `eventName`, `pagePath`, `linkUrl` | `eventCount`, `screenPageViews`, `keyEvents` | | **Session Scope** | Attributes of a single visit | `sessionDefaultChannelGroup`, `sessionSource` | `sessions`, `bounceRate`, `averageSessionDuration` | | **User Scope** | Lifetime attributes of an individual | `firstUserDefaultChannelGroup`, `firstUserSource` | `totalUsers`, `newUsers`, `activeUsers` |
---
| Dimension In Query | Incompatible Metric | What Fails | Valid Alternative | |---|---|---|---| | `sessionSource` / `sessionMedium` | `eventCount` | Mixing session dimension with hit metric | Use `sessions` or `engagedSessions` | | `eventName` | `sessions` | Asking for session counts of an event | Use `eventCount` | | `itemId` / `itemName` | `sessions` or `totalUsers` | Item dimensions do not carry session scope | Use `itemsViewed`, `addToCarts`, `itemsPurchased` | | `firstUserSource` | `sessions` | Lifetime acquisition with session metric | Use `newUsers` or `totalUsers` | | `promotionName` | `sessions` | Promotion items are hit-scoped | Use `promotionViews`, `promotionClicks` |
---
Certain dimensions are universally compatible across almost all metrics:
These can be safely combined with event metrics (`screenPageViews`, `eventCount`), session metrics (`sessions`, `bounceRate`), and e-commerce metrics (`purchaseRevenue`).
---
When Google Analytics returns an incompatibility error, the API payload explicitly names the offending field:
Please remove eventCount to make the request compatible for example.
Follow the recommendation directly: remove the conflicting metric and replace it with a metric from the same scope as your dimensions.
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:
How to track and measure traffic from ChatGPT, Claude, Perplexity, and Gemini in GA4. Exact dimension filters, regex patterns,…
Why session, user, and event metrics never match in GA4. Rules for pairing dimensions and metrics across user-scoped,…
Detect and filter automated bot spikes in Google Analytics 4. Patterns for datacenter ASN spikes, zero-second sessions, and…
How GA4 Default Channel Groups work, how to audit channel performance, and how to spot traffic falling into Unassigned or Direct…
Exact API field names for GA4 Data API queries. Avoid 400 errors from Universal Analytics names like ga:sessions or pageviews by…
Evaluate landing pages and blog content in GA4: screenPageViews, average engagement time, bounce rates, and organic search…
Use this skill when the user requests to review, analyze, critique, or summarize academic papers, research articles, preprints,…
Research what people actually say about any topic in the last 30 days. Pulls posts and engagement from Reddit, X, YouTube,…
Estimates intracellular metabolic fluxes from steady-state carbon-13 isotope-tracing measurements using validated atom maps,…
Search literature across sources, verify or manage citations, and build MeSH strategies or citation-impact audits. Use for…