attribution-scope
Why session, user, and event metrics never match in GA4. Rules for pairing dimensions and metrics across user-scoped,…
How to track and measure traffic from ChatGPT, Claude, Perplexity, and Gemini in GA4. Exact dimension filters, regex patterns, and channel comparison rules.
Claude Code
$ npx -y skills add surendranb/google-analytics-mcp --skill ai-referral-analysis --agent claude-code
Codex
$ npx skills add surendranb/google-analytics-mcp --skill ai-referral-analysis -a codex -y
Cursor
$ npx skills add surendranb/google-analytics-mcp --skill ai-referral-analysis -a cursor -y
Gemini CLI
$ npx skills add surendranb/google-analytics-mcp --skill ai-referral-analysis -a gemini-cli -y
GitHub Copilot
$ npx skills add surendranb/google-analytics-mcp --skill ai-referral-analysis -a github-copilot -y
OpenCode
$ npx skills add surendranb/google-analytics-mcp --skill ai-referral-analysis -a opencode -y
Windsurf
$ npx skills add surendranb/google-analytics-mcp --skill ai-referral-analysis -a windsurf -y
name: ai-referral-analysis titleTag: "Track AI Traffic in GA4: ChatGPT, Claude, Perplexity" description: "How to track and measure traffic from ChatGPT, Claude, Perplexity, and Gemini in GA4. Exact dimension filters, regex patterns, and channel comparison rules."
Measure traffic arriving from generative AI assistants — ChatGPT, Claude, Perplexity, Gemini, Microsoft Copilot, and others — and understand how AI-driven discovery behaves compared to organic search and direct traffic.
These domains appear in GA4 under the `sessionSource` dimension when users click links cited inside AI chat windows:
| AI Platform | Source Domains (`sessionSource`) | Default Channel Group | |---|---|---| | **ChatGPT** | `chatgpt.com`, `chat.openai.com` | `AI Assistant` or `Referral` | | **Claude** | `claude.ai` | `AI Assistant` or `Referral` | | **Perplexity** | `perplexity.ai` | `AI Assistant` or `Referral` | | **Google Gemini** | `gemini.google.com` | `AI Assistant` or `Referral` | | **Microsoft Copilot** | `copilot.microsoft.com`, `bing.com` | `AI Assistant` or `Organic Search` | | **You.com** | `you.com` | `Referral` | | **Grok** | `grok.x.ai`, `x.com` | `Referral` or `Organic Social` |
> **Note on Native GA4 Tracking:** Google Analytics 4 includes an **AI Assistant** channel within the Default Channel Group for major platforms. However, traffic from new AI browsers or unclassified models frequently lands under generic `Referral` or `Direct`. Filtering by `sessionSource` guarantees complete coverage.
---
Track total volume and trajectory over time:
dimensions: ["date", "sessionSource"]
metrics: ["sessions", "newUsers", "userEngagementDuration", "screenPageViews"]
dimension_filter: sessionSource contains "chatgpt.com" OR "perplexity.ai" OR
"claude.ai" OR "gemini.google.com" OR "copilot.microsoft.com"
date_range: last 30–90 daysPlotting `date` against `sessions` reveals whether AI traffic is expanding month-over-month.
---
Compare visitor engagement quality between AI referrals and your standard channels:
dimensions: ["sessionDefaultChannelGroup", "sessionSource"]
metrics: ["sessions", "userEngagementDuration", "screenPageViewsPerSession",
"keyEvents", "bounceRate"]
date_range: last 30 daysFilter results to AI sources and evaluate:
---
Discover which URLs AI models cite most frequently:
dimensions: ["sessionSource", "landingPage"] metrics: ["sessions", "userEngagementDuration", "keyEvents"] dimension_filter: sessionSource contains "chatgpt.com" OR "perplexity.ai" OR "claude.ai" date_range: last 30 days order_by: sessions DESC
This pinpoints the exact documentation, articles, or product pages driving AI search citations.
---
Once connected to GA4 MCP, you can copy-paste these prompts directly into Claude, Cursor, or Gemini CLI:
1. "Show all referral traffic from AI platforms (ChatGPT, Claude, Perplexity, Gemini) over the last 90 days. Report monthly sessions, active users, and average engagement duration per source." 2. "Compare the engagement quality of AI assistant traffic against traditional Organic Search for the past 30 days. Show bounce rate, session duration, and key events per session." 3. "Which specific landing pages are AI assistants citing? List the top 10 landing pages for chatgpt.com and perplexity.ai over the last 60 days sorted by sessions descending."
1. Open [Google Analytics](https://analytics.google.com). 2. Go to **Reports → Acquisition → Traffic acquisition**. 3. Switch the primary dimension dropdown from *Session default channel group* to **Session source / medium**. 4. In the table search bar, type `chatgpt.com` or `perplexity.ai` to view immediate session totals.
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:
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…
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…