Skip to main content
MCP server CX Codex

google-analytics-mcp — Claude Code MCP server for GA4

Connect an AI agent to Google Analytics 4 to inspect property schemas and build reports. Useful for traffic, channel, and conversion analysis.

Install into Claude Code · Platform CLI All methods and platforms ↓
claude mcp add google-analytics-mcp -e GOOGLE_APPLICATION_CREDENTIALS=<GOOGLE_APPLICATION_CREDENTIALS> -e GA4_PROPERTY_ID=<GA4_PROPERTY_ID> -- uvx google-analytics-mcp
Open on GitHub

What google-analytics-mcp does

The server queries GA4 using selected dimensions, metrics, and date ranges, then aggregates report totals on the server. It can also list accessible accounts and properties, retrieve property metadata, and expose metric compatibility rules. Setup requires GOOGLE_APPLICATION_CREDENTIALS and GA4_PROPERTY_ID.

Available tools include real-time reports and search over analytical guides for tasks such as diagnosing traffic drops, attribution, and e-commerce analysis. Guides load from GitHub. The package collects diagnostic telemetry about command runs, latency, and error codes; set DO_NOT_TRACK=1 or MCP_TELEMETRY_OPT_OUT=1 to opt out. You need Google credentials and a GA4 property ID to connect.

What it helps with

  • build GA4 reports from selected dimensions and metrics
  • inspect accessible accounts and properties
  • check a property's metric and dimension schema
  • investigate a sudden traffic decline with a guided analysis
  • separate referrals from ChatGPT, Claude, Perplexity, and Gemini

Example prompts for the agent

  • Compare GA4 traffic across channels for the selected date ranges.
  • List the dimensions and metrics available for my GA4 property.
  • Investigate the traffic drop using the traffic-diagnosis guide.

How to install google-analytics-mcp

Platform CLI

claude mcp add google-analytics-mcp -e GOOGLE_APPLICATION_CREDENTIALS=<GOOGLE_APPLICATION_CREDENTIALS> -e GA4_PROPERTY_ID=<GA4_PROPERTY_ID> -- uvx google-analytics-mcp

Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from google-analytics-mcp <command>

Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more

Questions about google-analytics-mcp

How do I install google-analytics-mcp in Claude Code?

Run `claude mcp add google-analytics-mcp -e GOOGLE_APPLICATION_CREDENTIALS=<GOOGLE_APPLICATION_CREDENTIALS> -e GA4_PROPERTY_ID=<GA4_PROPERTY_ID> -- uvx google-analytics-mcp`. Replace the placeholders with the credentials file path and GA4 property ID.

What does google-analytics-mcp do?

It connects an agent to GA4 for reporting, property and schema inspection, and analysis with built-in guides.

What do I need to connect it to GA4?

Set GOOGLE_APPLICATION_CREDENTIALS to the credentials file path and GA4_PROPERTY_ID to the property ID.

Similar MCP servers

All MCP servers for Data and databases →

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor