ai-referral-analysis
How to track and measure traffic from ChatGPT, Claude, Perplexity, and Gemini in GA4. Exact dimension filters, regex patterns,β¦
Exact API field names for GA4 Data API queries. Avoid 400 errors from Universal Analytics names like ga:sessions or pageviews by using valid GA4 schema.
Claude Code
$ npx -y skills add surendranb/google-analytics-mcp --skill common-metric-names --agent claude-code
Codex
$ npx skills add surendranb/google-analytics-mcp --skill common-metric-names -a codex -y
Cursor
$ npx skills add surendranb/google-analytics-mcp --skill common-metric-names -a cursor -y
Gemini CLI
$ npx skills add surendranb/google-analytics-mcp --skill common-metric-names -a gemini-cli -y
GitHub Copilot
$ npx skills add surendranb/google-analytics-mcp --skill common-metric-names -a github-copilot -y
OpenCode
$ npx skills add surendranb/google-analytics-mcp --skill common-metric-names -a opencode -y
Windsurf
$ npx skills add surendranb/google-analytics-mcp --skill common-metric-names -a windsurf -y
name: common-metric-names titleTag: "GA4 Dimensions & Metrics Reference: API Field Names" description: "Exact API field names for GA4 Data API queries. Avoid 400 errors from Universal Analytics names like ga:sessions or pageviews by using valid GA4 schema."
The Google Analytics 4 (GA4) Data API enforces strict field naming conventions. Universal Analytics was sunset on July 1, 2023, and on May 6, 2024, Google renamed all conversion metrics to **key events** (`conversions` β `keyEvents`).
Querying invalid field names causes a hard 400 error. Use this reference table before constructing queries or prompts.
| Metric Intent | Legacy / Invalid Names (Fails) | Valid GA4 Data API Name | |---|---|---| | **Conversions / Goal Completions** | `conversions`, `goals`, `conversion` | `keyEvents` | | **Session Conversion Rate** | `conversionRate`, `sessionConversionRate` | `sessionKeyEventRate` | | **User Conversion Rate** | `userConversionRate` | `userKeyEventRate` | | **Total Users** | `users`, `totalVisitors` | `totalUsers` | | **Active Users** | `uniqueUsers`, `activeVisitors` | `activeUsers` | | **Daily Active Users (DAU)** | `DAU`, `dailyActiveUsers` | `active1DayUsers` | | **Weekly Active Users (WAU)** | `WAU`, `weeklyActiveUsers` | `active7DayUsers` | | **Monthly Active Users (MAU)** | `MAU`, `monthlyActiveUsers` | `active28DayUsers` | | **Pageviews** | `pageviews`, `pageViews`, `page_views` | `screenPageViews` | | **Pages per Session** | `pagesPerSession`, `pageDepth` | `screenPageViewsPerSession` | | **E-commerce Purchases** | `purchases`, `transactions` | `ecommercePurchases` | | **Product Views** | `itemViews`, `productViews` | `itemsViewed` | | **Items Added to Cart** | `addToCarts`, `cartAdds` | `itemsAddedToCart` | | **Purchase Revenue** | `revenue`, `ecommerceRevenue` | `purchaseRevenue` | | **Average Order Value (AOV)** | `revenuePerTransaction` | `averagePurchaseRevenue` | | **Average Session Duration** | `avgSessionDuration`, `avgTimeOnSite` | `averageSessionDuration` | | **Total Engagement Time** | `engagementDuration`, `timeOnSite` | `userEngagementDuration` | | **Engaged Sessions** | `qualifiedSessions`, `validSessions` | `engagedSessions` | | **Bounce Rate** | `bounce_rate` | `bounceRate` |
---
| Dimension Intent | Legacy / Invalid Names (Fails) | Valid GA4 Data API Name | |---|---|---| | **Default Channel Group** | `channelGrouping`, `sessionDefaultChannelGrouping` | `sessionDefaultChannelGroup` | | **Traffic Source** | `source`, `session_source` | `sessionSource` | | **Traffic Medium** | `medium`, `session_medium` | `sessionMedium` | | **Source / Medium Combined** | `sourceMedium` | `sessionSourceMedium` | | **Campaign Name** | `campaign` | `sessionCampaignName` | | **Page Path** | `page`, `page_path` | `pagePath` | | **Page Path with Query** | `pagePathPlusQueryString` | `unifiedPagePathScreen` | | **Landing Page** | `landingPagePath` | `landingPage` | | **Landing Page with Query** | `landingPage` (when query needed) | `landingPagePlusQueryString` | | **Page Title** | `title`, `page_title` | `pageTitle` | | **Device Category** | `device`, `deviceType` | `deviceCategory` | | **Operating System** | `os` | `operatingSystem` | | **Browser** | `userAgent` | `browser` | | **Country** | `countryName` | `country` | | **City** | `cityName` | `city` |
---
GA4 does not provide literal `DAU` or `MAU` metrics. It provides rolling windows:
> **Important:** Never sum daily `activeUsers` across rows to compute a monthly total. Summing rows double-counts returning users. Request `activeUsers` once over the full date range with no `date` dimension, and GA4 will return the true deduped count.
---
If you are unsure of a dimension or metric name for your specific property, ask your agent:
search_schema("keyword")The server queries your live GA4 metadata schema and returns all matching dimensions and metrics with exact API identifiers.
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β¦
Which dimensions and metrics can be queried together in GA4 without triggering incompatible scope errors. Matrix of user,β¦
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β¦