← 返回 Skills 市场
vittor1o

Google Analytics MCP

作者 vittor1o · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
68
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install google-analytics-mcp
功能描述
Query Google Analytics 4 data — reports, funnels, realtime, property details — via the GA MCP server. Uses per-workspace service account credentials; no Gemi...
使用说明 (SKILL.md)

Google Analytics

Query GA4 properties using the Google Analytics MCP server via MCPorter. Each workspace supplies its own service account credentials — no shared or global auth.

Prerequisites

  • uvx (from uv) — runs analytics-mcp ephemerally, no install needed
  • mcporternpm i -g mcporter
  • Service account JSON with GA read access in the workspace (see Setup)

Per-workspace credentials

Each workspace stores its own credentials:

{workspace}/
  credentials/
    ga-service-account.json   ← Google service account key file
    ga-config.json            ← optional: default project/property

ga-config.json shape (optional):

{
  "projectId": "my-gcp-project",
  "defaultProperty": "properties/123456789"
}

If ga-config.json is absent, pass property explicitly in every query.

Workflow

  1. Locate credentials — read {workspace}/credentials/ga-service-account.json (fail clearly if missing).
  2. Load config — read {workspace}/credentials/ga-config.json if present; extract projectId and defaultProperty.
  3. Run query via the helper script or direct mcporter call:
bash {skill_dir}/scripts/ga.sh \x3Cworkspace> \x3Ctool> [args...]

Or directly:

CREDS="{workspace}/credentials/ga-service-account.json"
PROJECT_ID="$(cat {workspace}/credentials/ga-config.json | python3 -c 'import json,sys; print(json.load(sys.stdin).get("projectId",""))')"

mcporter call \
  --stdio uvx \
  --stdio-arg analytics-mcp \
  --env "GOOGLE_APPLICATION_CREDENTIALS=$CREDS" \
  --env "GOOGLE_CLOUD_PROJECT=$PROJECT_ID" \
  "analytics-mcp.\x3Ctool>" \
  [key=value ...]

Available tools

Tool Purpose
get_account_summaries List all GA accounts + properties the SA has access to
get_property_details Details for a specific property
run_report Standard GA4 data report (dimensions, metrics, date ranges)
run_funnel_report Funnel analysis
run_realtime_report Realtime data
get_custom_dimensions_and_metrics Custom dimensions/metrics for a property
list_google_ads_links Google Ads links for a property

Common queries

List all accessible properties:

mcporter call --stdio uvx --stdio-arg analytics-mcp \
  --env "GOOGLE_APPLICATION_CREDENTIALS=$CREDS" \
  analytics-mcp.get_account_summaries

Run a report (sessions last 30 days):

mcporter call --stdio uvx --stdio-arg analytics-mcp \
  --env "GOOGLE_APPLICATION_CREDENTIALS=$CREDS" \
  --env "GOOGLE_CLOUD_PROJECT=$PROJECT_ID" \
  analytics-mcp.run_report \
  property=properties/123456789 \
  'dimensions=[{"name":"date"}]' \
  'metrics=[{"name":"sessions"}]' \
  'dateRanges=[{"startDate":"30daysAgo","endDate":"today"}]'

Setup (one-time per workspace)

See references/setup.md for full instructions. Short version:

  1. Create a GCP service account
  2. Enable Google Analytics Admin API and Google Analytics Data API
  3. Download the JSON key → save to {workspace}/credentials/ga-service-account.json
  4. In GA4: Admin → Property Access Management → add the service account email as Viewer
  5. Test: bash {skill_dir}/scripts/ga.sh {workspace} get_account_summaries

Error notes

  • PERMISSION_DENIED — SA email not added to GA property access
  • credentials not found — check ga-service-account.json path
  • API not enabled — enable Admin + Data APIs in GCP console
安全使用建议
Install only in workspaces where you are comfortable granting read access to the relevant GA4 properties. Create a least-privilege service account with Viewer access only, keep the credentials directory out of source control and backups where possible, restrict file permissions, and rotate or revoke the JSON key if it may have been shared or committed.
能力评估
Purpose & Capability
The stated purpose is to query GA4 reports, funnels, realtime data, and property details through the Google Analytics MCP server, and the required GA service account access is directly related to that purpose.
Instruction Scope
Runtime instructions are scoped to workspace-local GA credential/config files and named GA MCP tools; the helper passes the requested tool name through to the GA MCP server, so users should invoke only the documented read/reporting tools.
Install Mechanism
The skill requires uvx and mcporter and the helper runs mcporter/analytics-mcp through package tooling, which is expected for this MCP wrapper but depends on external packages at runtime.
Credentials
The skill stores a Google service account JSON key under the workspace credentials directory and uses it as GOOGLE_APPLICATION_CREDENTIALS; this is proportionate for GA API access, and the setup recommends Viewer access.
Persistence & Privilege
There is no hidden persistence or privilege escalation, but the service account key is a long-lived local credential and should be protected, excluded from git, and rotated if exposed.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install google-analytics-mcp
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /google-analytics-mcp 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release: query GA4 reports, funnels, realtime data and property details via MCP server
元数据
Slug google-analytics-mcp
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Google Analytics MCP 是什么?

Query Google Analytics 4 data — reports, funnels, realtime, property details — via the GA MCP server. Uses per-workspace service account credentials; no Gemi... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 68 次。

如何安装 Google Analytics MCP?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install google-analytics-mcp」即可一键安装,无需额外配置。

Google Analytics MCP 是免费的吗?

是的,Google Analytics MCP 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Google Analytics MCP 支持哪些平台?

Google Analytics MCP 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Google Analytics MCP?

由 vittor1o(@vittor1o)开发并维护,当前版本 v1.0.0。

💬 留言讨论