Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Google Analytics 4, Search Console, and Indexing API toolkit. Analyze website traffic, page performance, user demographics, real-time visitors, search queries, and SEO metrics. Use when the user asks to: check site traffic, analyze page views, see traffic sources, view user demographics, get real-time visitor data, check search console queries, analyze SEO performance, request URL re-indexing, inspect index status, compare date ranges, check bounce rates, view conversion data, or get e-commerce
.claude/skills/sundial-org-ga4-analytics/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-04 | ✗→✓ | ▲ Improved | 1% | 0% |
| case-06 | ✗→✓ | ▲ Improved | 4% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 21% | 0% |
| case-08 | ✗→✓ | ▲ Improved | 20% | 0% |
| case-09 | ✗→✓ | ▲ Improved | 67% | 0% |
Install dependencies:
bashcd scripts && npm install
Configure credentials by creating a .env file in the project root:
GA4_PROPERTY_ID=123456789
GA4_CLIENT_EMAIL=service-account@project.iam.gserviceaccount.com
GA4_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n"
SEARCH_CONSOLE_SITE_URL=https://your-domain.com
GA4_DEFAULT_DATE_RANGE=30dPrerequisites: A Google Cloud project with the Analytics Data API, Search Console API, and Indexing API enabled. A service account with access to your GA4 property and Search Console.
| User says | Function to call | |-----------|-----------------| | "Show me site traffic for the last 30 days" | siteOverview("30d") | | "What are my top search queries?" | searchConsoleOverview("30d") | | "Who's on the site right now?" | liveSnapshot() | | "Reindex these URLs" | reindexUrls(["https://example.com/page1", ...]) | | "Compare this month vs last month" | compareDateRanges({startDate: "30daysAgo", endDate: "today"}, {startDate: "60daysAgo", endDate: "31daysAgo"}) | | "What pages get the most traffic?" | contentPerformance("30d") |
Execute functions by importing from scripts/src/index.ts:
typescriptimport { siteOverview, searchConsoleOverview } from './scripts/src/index.js'; const overview = await siteOverview('30d');
Or run directly with tsx:
bashnpx tsx scripts/src/index.ts
Every analysis follows three phases:
Run API functions. Each call hits the Google APIs and returns structured data.
All results automatically save as timestamped JSON files to results/{category}/. File naming pattern: YYYYMMDD_HHMMSS__operation__extra_info.json
After analysis, read the saved JSON files and create a markdown summary in results/summaries/ with data tables, trends, and recommendations.
| Function | Purpose | What it gathers | |----------|---------|----------------| | siteOverview(dateRange?) | Comprehensive site snapshot | Page views, traffic sources, demographics, events | | trafficAnalysis(dateRange?) | Traffic deep-dive | Sources, sessions by source/medium, new vs returning | | contentPerformance(dateRange?) | Top pages analysis | Page views, landing pages, exit pages | | userBehavior(dateRange?) | Engagement patterns | Demographics, events, daily engagement metrics | | compareDateRanges(range1, range2) | Period comparison | Side-by-side metrics for two date ranges | | liveSnapshot() | Real-time data | Active users, current pages, current events |
| Function | Purpose | What it gathers | |----------|---------|----------------| | searchConsoleOverview(dateRange?) | SEO snapshot | Top queries, pages, device, country breakdown | | keywordAnalysis(dateRange?) | Keyword deep-dive | Queries with device breakdown | | seoPagePerformance(dateRange?) | Page SEO metrics | Top pages by clicks, country breakdown |
| Function | Purpose | |----------|---------| | reindexUrls(urls) | Request re-indexing for multiple URLs | | checkIndexStatus(urls) | Check if URLs are indexed |
| Function | Purpose | |----------|---------| | getAvailableFields() | List all available GA4 dimensions and metrics |
For granular control, import specific functions from the API modules. See references/api-reference.md for the complete list of 30+ API functions with parameters, types, and examples.
All functions accept flexible date range formats:
| Format | Example | Description | |--------|---------|-------------| | Shorthand | "7d", "30d", "90d" | Days ago to today | | Explicit | {startDate: "2024-01-01", endDate: "2024-01-31"} | Specific dates | | GA4 relative | {startDate: "30daysAgo", endDate: "today"} | GA4 relative format |
Default is "30d" (configurable via GA4_DEFAULT_DATE_RANGE in .env).
Results auto-save to results/ with this structure:
results/
├── reports/ # GA4 standard reports
├── realtime/ # Real-time snapshots
├── searchconsole/ # Search Console data
├── indexing/ # Indexing API results
└── summaries/ # Human-readable markdown summariestypescriptimport { listResults, loadResult, getLatestResult } from './scripts/src/index.js'; // List recent results const files = listResults('reports', 10); // Load a specific result const data = loadResult(files[0]); // Get most recent result for an operation const latest = getLatestResult('reports', 'site_overview');
pagePath, pageTitle, sessionSource, sessionMedium, country, deviceCategory, browser, date, eventName, landingPage, newVsReturning
screenPageViews, activeUsers, sessions, newUsers, bounceRate, averageSessionDuration, engagementRate, conversions, totalRevenue, eventCount
compareDateRanges() to spot trends (this month vs last month)liveSnapshot() shows who's on the site right now| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-21 | fail→fail | 22,877 | 26,247 | +15% | 1 | 1 | 0% | 4,846 | 6,926 | +43% | 0 | 0 | — |
case-01 | fail→fail | 16,416 | 7,326 | -55% | 1 | 1 | 0% | 2,824 | 1,768 | -37% | 0 | 0 | — |
case-02 | fail→fail | 13,703 | 6,601 | -52% | 1 | 1 | 0% | 2,277 | 1,870 | -18% | 0 | 0 | — |
case-03 | fail→fail | 6,656 | 6,825 | +3% | 1 | 1 | 0% | 992 | 1,906 | +92% | 0 | 0 | — |
case-04 | fail→pass | 16,286 | 7,422 | -54% | 1 | 1 | 0% | 2,818 | 2,834 | +1% | 0 | 0 | — |
case-05 | fail→fail | 9,647 | 7,073 | -27% | 1 | 1 | 0% | 1,473 | 2,527 | +72% | 0 | 0 | — |
case-06 | fail→pass | 11,302 | 3,873 | -66% | 1 | 1 | 0% | 2,095 | 2,185 | +4% | 0 | 0 | — |
case-07 | fail→pass | 13,833 | 7,163 | -48% | 1 | 1 | 0% | 2,133 | 2,573 | +21% | 0 | 0 | — |
case-08 | fail→pass | 9,350 | 3,373 | -64% | 1 | 1 | 0% | 1,641 | 1,977 | +20% | 0 | 0 | — |
case-09 | fail→pass | 7,487 | 2,763 | -63% | 1 | 1 | 0% | 1,157 | 1,937 | +67% | 0 | 0 | — |
case-10 | fail→pass | 15,383 | 4,406 | -71% | 1 | 1 | 0% | 2,703 | 2,259 | -16% | 0 | 0 | — |
case-11 | fail→pass | 11,208 | 3,917 | -65% | 1 | 1 | 0% | 2,033 | 2,219 | +9% | 0 | 0 | — |
case-12 | pass→pass | 13,517 | 2,390 | -82% | 1 | 1 | 0% | 2,042 | 1,877 | -8% | 0 | 0 | — |
case-13 | fail→pass | 10,418 | 3,843 | -63% | 1 | 1 | 0% | 1,803 | 2,107 | +17% | 0 | 0 | — |
case-14 | fail→pass | 13,146 | 9,451 | -28% | 1 | 1 | 0% | 1,924 | 3,020 | +57% | 0 | 0 | — |
case-15 | fail→pass | 6,546 | 3,199 | -51% | 1 | 1 | 0% | 1,255 | 2,146 | +71% | 0 | 0 | — |
case-22 | fail→fail | 9,251 | 12,397 | +34% | 1 | 1 | 0% | 1,619 | 3,768 | +133% | 0 | 0 | — |
case-16 | fail→pass | 8,757 | 4,239 | -52% | 1 | 1 | 0% | 1,749 | 2,361 | +35% | 0 | 0 | — |
case-17 | fail→pass | 8,838 | 2,401 | -73% | 1 | 1 | 0% | 1,832 | 1,905 | +4% | 0 | 0 | — |
case-18 | pass→pass | 7,252 | 2,366 | -67% | 1 | 1 | 0% | 1,267 | 1,928 | +52% | 0 | 0 | — |
case-19 | pass→pass | 4,145 | 1,920 | -54% | 1 | 1 | 0% | 768 | 1,801 | +135% | 0 | 0 | — |
case-20 | fail→fail | 11,235 | 10,038 | -11% | 1 | 1 | 0% | 2,022 | 3,190 | +58% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted, and 19 counted toward the lift figure. The other 3 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +55 percentage points is the difference between those two pass rates over the 19 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.