ai-referral-analysis
Measure traffic arriving from AI tools — ChatGPT, Claude, Perplexity, Gemini, Copilot, and others — and understand how it behaves…
Universal Analytics (UA) and GA4 use different names for equivalent concepts. UA was sunset on 2023-07-01; models trained before or around then guess UA field names that no longer exist in the GA4 Data API. On 2024-05-06 GA4 also renamed \"conversions\" to \"key events\" (see
$ npx -y skills add surendranb/google-analytics-mcp --skill ua-to-ga4 --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/ua-to-ga4Context preview
The summary Claude sees to decide when to auto-load this skill.
Universal Analytics (UA) and GA4 use different names for equivalent concepts. UA was sunset on 2023-07-01; models trained before or around then guess UA field names that no longer exist in the GA4 Data API. On 2024-05-06 GA4 also renamed \"conversions\" to \"key events\" (see
name: ua-to-ga4 description: "Universal Analytics (UA) and GA4 use different names for equivalent concepts. UA was sunset on 2023-07-01; models trained before or around then guess UA field names that no longer exist in the GA4 Data API. On 2024-05-06 GA4 also renamed \"conversions\" to \"key events\" (see the conversions rows below). If a name feels obviously right but returns \"Invalid metric/dimension\", assume your training predates the change and verify with `search_schema`. This skill gives the correct GA4 Data API name for every common UA metric and dimension."
Universal Analytics (UA) and GA4 use different names for equivalent concepts. UA was sunset on 2023-07-01; models trained before or around then guess UA field names that no longer exist in the GA4 Data API. On 2024-05-06 GA4 also renamed "conversions" to "key events" (see the conversions rows below). If a name feels obviously right but returns "Invalid metric/dimension", assume your training predates the change and verify with `search_schema`. This skill gives the correct GA4 Data API name for every common UA metric and dimension.
| UA name (wrong) | GA4 API name (correct) | |---|---| | `users` | `totalUsers` | | `uniquePageviews` | `screenPageViews` | | `pageviews` | `screenPageViews` | | `avgSessionDuration` | `averageSessionDuration` | | `timeOnPage` / `avgTimeOnPage` | `userEngagementDuration` | | `goalCompletionsAll` / `conversions` | `keyEvents` | | `goalConversionRateAll` / `conversionRate` / `sessionConversionRate` | `sessionKeyEventRate` | | `userConversionRate` | `userKeyEventRate` | | `transactions` / `purchases` | `ecommercePurchases` | | `transactionRevenue` / `revenue` | `purchaseRevenue` | | `revenuePerTransaction` | `averagePurchaseRevenue` | | `transactionsPerSession` | `purchaseToViewRate` | | `itemQuantity` / `itemViews` | `itemsViewed` | | `itemRevenue` | `itemRevenue` (same) | | `entrances` | `sessions` (no direct equivalent — use sessions) | | `pageValue` | no direct equivalent |
| UA name (wrong) | GA4 API name (correct) | |---|---| | `channelGrouping` | `sessionDefaultChannelGroup` | | `defaultChannelGrouping` | `sessionDefaultChannelGroup` | | `source` | `sessionSource` | | `medium` | `sessionMedium` | | `campaign` | `sessionCampaignName` | | `keyword` | `sessionManualTerm` | | `sourceMedium` | `sessionSourceMedium` | | `adContent` | `sessionManualAdContent` | | `pagePath` | `pagePath` (same) | | `pageTitle` | `pageTitle` (same) | | `landingPagePath` | `landingPage` | | `exitPagePath` | no direct equivalent | | `deviceCategory` | `deviceCategory` (same) | | `operatingSystem` | `operatingSystem` (same) | | `browser` | `browser` (same) | | `country` | `country` (same) | | `city` | `city` (same) | | `userType` | use `newVsReturning` |
All GA4 API names are camelCase — never snake_case.
| Wrong (snake_case) | Correct | |---|---| | `page_path` | `pagePath` | | `session_source` | `sessionSource` | | `device_category` | `deviceCategory` | | `event_name` | `eventName` | | `total_users` | `totalUsers` |
GA4 splits attribution into three scopes. Use the right prefix:
| Scope | Prefix | Use for | |---|---|---| | Session | `session` (e.g. `sessionSource`) | Traffic acquisition analysis | | First user | `firstUser` (e.g. `firstUserSource`) | User acquisition analysis | | Event | `(none)` (e.g. `pagePath`) | Event-level analysis |
Mixing scopes causes 400 errors — see `compatible-combinations` skill.
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…
GA4 has three distinct attribution scopes. Using the wrong scope gives misleading results. Choose based on the question you are…
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…