ga4-analytics
БесплатноЗапускает вложенные скриптыНе проверенGoogle Analytics 4, Search Console and Indexing API toolkit: site traffic, top pages, traffic sources, demographics, real-time visitors, search queries, SEO…
от adamkristopher10 339 установок в других каталогахОб этом скилле
GA4 Analytics Toolkit
What this skill does with your data
- Network: calls Google only: the Analytics Data API, Search Console API and Indexing API (
*.googleapis.com). - Credentials: a Google Cloud service account from
.envin the working directory. Use least privilege: Viewer on the one GA4 property, and access to the one Search Console site. The Indexing API scope is needed only forreindexUrls/requestIndexing. Keep.envout of version control. - What's sent: your property ID, site URL, date ranges, and any URLs you ask to inspect or re-index.
- Changes it can make:
reindexUrlsasks Google to recrawl URLs.removeFromIndexasks Google to drop a URL from Search; it refuses unless called with{ confirm: true }, and should only be used when the site owner asks to remove that exact URL. Everything else is read-only. - Files: nothing is written unless you set
SAVE_RESULTS=true; no function argument can turn saving on. Saved files are readable only by you (0600) and can only go in theresults/folders listed below.
Setup
Install the pinned dependencies from the lockfile:
cd scripts && npm ci --ignore-scripts
Configure credentials by creating a .env file in the project root:
GA4_PROPERTY_ID=123456789
[email protected]
GA4_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n"
SEARCH_CONSOLE_SITE_URL=https://your-domain.com
GA4_DEFAULT_DATE_RANGE=30d
# Optional: keep results on disk
# SAVE_RESULTS=true
Prerequisites: 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.
Quick Start
| 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:
import { siteOverview, searchConsoleOverview } from './scripts/src/index.js';
const overview = await siteOverview('30d');
Or run it with the project's pinned tsx (installed by npm ci):
cd scripts && npm start
Workflow Pattern
Every analysis follows two phases:
1. Analyze
Run API functions. Each call hits the Google APIs and returns structured data to you. Nothing is written to disk.
2. Summarize
Summarize the returned data for the user: tables, trends and recommendations. Write a summary file only if the user asks for one.
Saving (opt-in): only with SAVE_RESULTS=true in .env are results also saved as timestamped JSON in results/{category}/ (YYYYMMDD_HHMMSS__operation__extra_info.json).
High-Level Functions
GA4 Analytics
| 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 |
Search Console
| 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 |
Indexing
| Function | Purpose |
|---|---|
reindexUrls(urls) |
Ask Google to recrawl multiple URLs |
checkIndexStatus(urls) |
Check if URLs are indexed (read-only) |
removeFromIndex(url, { confirm: true }) is available from the API module but is destructive: it asks Google to drop the URL from Search. Use it only when the site owner asks to remove that exact URL. See references/api-reference.md.
Utility
| Function | Purpose |
|---|---|
getAvailableFields() |
List all available GA4 dimensions and metrics |
Individual API Functions
For granular control, import specific functions from the API modules. See [references/a
Установить ga4-analytics в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл ga4-analytics?
Google Analytics 4, Search Console and Indexing API toolkit: site traffic, top pages, traffic sources, demographics, real-time visitors, search queries, SEO page performance, index status, re-index requests, and (only with explicit confirmation) requests to remove a URL from Google's index. Use when the user asks about their site's traffic, search queries or indexing. Uses the user's own Google service account from .env for one GA4 property and one Search Console site. Saves nothing to disk unless SAVE_RESULTS=true.
Как установить скилл ga4-analytics?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл ga4-analytics запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic