ai-referral-analysis
How to track and measure traffic from ChatGPT, Claude, Perplexity, and Gemini in GA4. Exact dimension filters, regex patterns,…
Detect and filter automated bot spikes in Google Analytics 4. Patterns for datacenter ASN spikes, zero-second sessions, and single-page screenPageViews.
Claude Code
$ npx -y skills add surendranb/google-analytics-mcp --skill bot-traffic-detection --agent claude-code
Codex
$ npx skills add surendranb/google-analytics-mcp --skill bot-traffic-detection -a codex -y
Cursor
$ npx skills add surendranb/google-analytics-mcp --skill bot-traffic-detection -a cursor -y
Gemini CLI
$ npx skills add surendranb/google-analytics-mcp --skill bot-traffic-detection -a gemini-cli -y
GitHub Copilot
$ npx skills add surendranb/google-analytics-mcp --skill bot-traffic-detection -a github-copilot -y
OpenCode
$ npx skills add surendranb/google-analytics-mcp --skill bot-traffic-detection -a opencode -y
Windsurf
$ npx skills add surendranb/google-analytics-mcp --skill bot-traffic-detection -a windsurf -y
name: bot-traffic-detection titleTag: "Identify & Filter Bot Traffic in Google Analytics 4" description: "Detect and filter automated bot spikes in Google Analytics 4. Patterns for datacenter ASN spikes, zero-second sessions, and single-page screenPageViews."
Identify and exclude bot, scraper, crawler, and spam sessions from your Google Analytics 4 reporting to protect conversion rates and prevent skewed traffic baselines.
Query sessions exhibiting zero or near-zero engagement duration:
dimensions: ["sessionDefaultChannelGroup", "sessionSource", "sessionMedium"] metrics: ["sessions", "userEngagementDuration", "bounceRate", "screenPageViewsPerSession"] date_range: last 7–14 days
**Bot indicators:** `userEngagementDuration` < 1.0 second, `screenPageViewsPerSession` exactly 1.0, and `bounceRate` at 1.0 (100%).
dimensions: ["sessionSource", "sessionMedium", "sessionDefaultChannelGroup"] metrics: ["sessions", "userEngagementDuration", "newUsers"] dimension_filter: sessionMedium = "referral"
Flag and isolate any referral source where `userEngagementDuration / sessions` is under 2 seconds.
dimensions: ["hostname"] metrics: ["sessions", "screenPageViews"]
Scrapers and spambots frequently fire Google Analytics measurement tags without actually visiting your domain (hitting raw IP addresses, scraper staging proxies, or ghost hosts). Always verify that `hostname` matches your legitimate production domains.
dimensions: ["country", "city", "sessionSource"] metrics: ["sessions", "userEngagementDuration"] order_by: sessions DESC
Clusters of hundreds of sessions originating from known datacenter hubs (e.g., Boardman, Ashburn, Council Bluffs) with zero engagement indicate automated cloud scraper runs rather than human browsing.
---
While Google Analytics 4 excludes known IAB-registered bots automatically, headless crawlers and custom scrapers bypass default filters.
To filter suspected bot traffic in API queries, combine dimension and metric filters:
---
Copy-paste these prompts into Claude, Cursor, or Gemini CLI:
1. "Audit our traffic from the last 7 days for bot contamination. Check bounce rate, average session duration, and single-page sessions grouped by sessionSource." 2. "List all sessions grouped by hostname over the past 30 days. Flag any traffic hitting hostnames other than our primary domain." 3. "Show me cities generating more than 100 sessions over the last 14 days where average engagement duration was under 3 seconds."
1. Open **Reports → Acquisition → Traffic acquisition**. 2. Add a secondary dimension: click the **+** icon next to the primary column and choose **Geography → City**. 3. Sort by **Sessions** descending. 4. Scan the **Average engagement time per session** column. Any city generating hundreds of sessions with 0:00 engagement represents automated bot traffic.
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,…
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…