ai-referral-analysis
Measure traffic arriving from AI tools — ChatGPT, Claude, Perplexity, Gemini, Copilot, and others — and understand how it behaves…
How to specify date ranges in `get_ga4_data` and how to structure period-over-period comparisons.
$ npx -y skills add surendranb/google-analytics-mcp --skill date-ranges --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/date-rangesContext preview
The summary Claude sees to decide when to auto-load this skill.
How to specify date ranges in `get_ga4_data` and how to structure period-over-period comparisons.
name: date-ranges description: "How to specify date ranges in `get_ga4_data` and how to structure period-over-period comparisons."
How to specify date ranges in `get_ga4_data` and how to structure period-over-period comparisons.
date_range_start / date_range_end accept: "YYYY-MM-DD" — absolute date, e.g. "2024-01-15" "today" — current day (partial — use carefully) "yesterday" — last complete day "NdaysAgo" — N days back from today, e.g. "7daysAgo", "30daysAgo", "90daysAgo"
`NdaysAgo` excludes today. `7daysAgo` to `yesterday` = last 7 complete days.
| Window | start | end | |---|---|---| | Last 7 days | `7daysAgo` | `yesterday` | | Last 28 days | `28daysAgo` | `yesterday` | | Last 90 days | `90daysAgo` | `yesterday` | | This month | `YYYY-MM-01` | `today` | | Last month | `YYYY-MM-01` (prior) | `YYYY-MM-last-day` (prior) | | Year to date | `YYYY-01-01` | `yesterday` |
The GA4 Data API does not support multi-period in a single call. Run two separate `get_ga4_data` calls, then compare the results.
**Example: week-over-week**
Call 1 — this week:
date_range_start: "7daysAgo" date_range_end: "yesterday"
Call 2 — last week:
date_range_start: "14daysAgo" date_range_end: "8daysAgo"
**Example: year-over-year for July**
Call 1 — this year:
date_range_start: "2025-07-01" date_range_end: "2025-07-31"
Call 2 — last year:
date_range_start: "2024-07-01" date_range_end: "2024-07-31"
Then compute the delta: `(current - prior) / prior * 100` for each metric.
`today` includes only the hours elapsed so far. Comparing `today` to `yesterday` is misleading — yesterday is a full day, today is partial.
For intra-day analysis, use `today` for both start and end and note the IST hours covered in your interpretation.
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…