The full upstream README, mirrored here for reference. Install config, tool schemas, adoption signals, and an original overview live on the MCP Google Analytics listing page.
A Model Context Protocol (MCP) server for Google Analytics 4, providing comprehensive integration with both the Google Analytics Data API (for reading reports) and Measurement Protocol v2 (for sending events).
The GA4 MCP that reads AND writes. Most GA4 MCP servers (including Google's official one) are read-only. This one gives your AI agent the full loop: run reports and funnels, audit your setup (custom dimensions, key events, compatibility checks), send ecommerce and conversion events server-side, and verify them in the realtime report — 26 tools in one npx command.
Built for agencies too: every read tool accepts an optional propertyId, so one conversation can query all your clients' properties — no reconfiguration between clients. See Multi-Property Mode.
You only need two values to start (same as any other GA4 MCP): the service account JSON and your property ID. Sending events is an optional extra.
Click Install in Cursor, then paste:
GA_SERVICE_ACCOUNT_JSON — path to the downloaded key file, or the JSON itselfGA_PROPERTY_ID — the numeric ID in GA4 Admin → Property Settings (e.g. 123456789)That is enough to ask “users by country this week”. To also send events, add two more keys later (see Send events (optional)).
Reports can get large. This server is designed with token optimization in mind:
limit parameter as neededSee the dedicated Token Optimization Guide for strategies to minimize token usage.
See QUICKSTART.md for a 5-minute setup guide, or follow the installation steps below.
Start with two values. That unlocks reports, funnels, realtime, and property audits — everything most people need, and the same setup every other GA4 MCP asks for.
Use the file path or paste the JSON into GA_SERVICE_ACCOUNT_JSON.
GA4 Admin → Property Settings → Property ID (numbers only, e.g. 123456789).
You can now ask: “Show me active users by country this week.”
Only if you want the agent to record events (purchases, signups, custom events). Most GA4 MCPs cannot do this; it is extra, not required.
G-XXXXXXXXXX).Add them next to the two values you already have:
Every read tool accepts an optional propertyId argument that overrides the configured GA_PROPERTY_ID — so a single conversation can query any property the service account can access, with no reconfiguration between clients.
GA_SERVICE_ACCOUNT_JSON (GA_PROPERTY_ID becomes optional — if set, it acts as the default).propertyId accepts both 123456789 and properties/123456789. Event sending (Measurement Protocol) remains tied to the configured GA_MEASUREMENT_ID/GA_API_SECRET, since each data stream has its own secret.
Add to your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%/Claude/claude_desktop_config.json
Or if installed globally:
Restart Claude Desktop after updating the configuration.
Add to your Cursor MCP settings file:
macOS/Linux: ~/.cursor/mcp.json
Windows: %USERPROFILE%\.cursor\mcp.json
Restart Cursor after updating the configuration.
Reading data (Google Analytics Data API) — all read tools default to 10 rows to save tokens:
| Tool | Purpose | Notes |
|---|---|---|
ga_run_report | Custom reports with dimensions and metrics | Adjust limit as needed |
ga_run_realtime_report | Real-time data (last 30 minutes) | Great for verifying sent events |
ga_get_metadata | All available dimensions and metrics | Large response (500+ items), use sparingly |
ga_list_accounts | List accessible GA accounts | |
ga_list_properties | List GA4 properties | Aggregates all accounts if no accountId |
ga_get_property | Details of the configured property | |
ga_list_data_streams | Data streams of the property | Useful to find measurement IDs |
ga_run_pivot_report | Pivot table reports | Responses can be very large |
ga_run_funnel_report | Funnel analysis across event steps | Uses Data API v1alpha |
ga_batch_run_reports | Multiple reports in one request | 2–5 reports per batch recommended |
ga_get_account_summaries | All accounts and properties in one call | Fastest way to discover IDs |
ga_list_custom_dimensions | Custom dimensions of the property | Discover API names for reports |
ga_list_custom_metrics | Custom metrics of the property | Discover API names for reports |
ga_list_key_events | Key events (conversions) of the property | Know what counts as a conversion |
ga_list_google_ads_links | Google Ads accounts linked to the property | |
ga_check_compatibility | Validate dimension/metric combos before reporting | Avoids wasted requests and error loops |
Sending events (Measurement Protocol):
| Tool | Purpose |
|---|---|
ga_send_event | Any custom GA4 event with parameters |
ga_validate_event | Test an event against the debug endpoint without recording it |
ga_send_pageview | Page/screen views |
ga_send_purchase | Ecommerce purchases with transaction and items |
ga_send_login | User logins |
ga_send_signup | User registrations |
ga_send_view_item | Product/item detail views |
ga_send_add_to_cart | Add-to-cart events |
ga_send_begin_checkout | Checkout initiations |
ga_send_refund | Full or partial refunds |
ga_run_reportRun custom reports with dimensions and metrics.
Common Dimensions: date, city, country, deviceCategory, browser, pagePath, eventName, sessionSource, sessionMedium, sessionCampaignName
Common Metrics: activeUsers, sessions, screenPageViews, conversions, totalRevenue, engagementRate, averageSessionDuration
Example:
ga_run_realtime_reportGet real-time data (last 30 minutes).
Example:
ga_get_metadataGet all available dimensions and metrics for your property.
Warning: Returns 500+ items. Use sparingly.
ga_list_accountsList all GA accounts accessible to the service account.
ga_list_propertiesList GA4 properties, optionally filtered by account ID.
ga_get_propertyGet details about the configured property.
ga_list_data_streamsList data streams for the configured property.
ga_run_pivot_reportRun pivot table reports with row/column dimensions.
Example:
ga_run_funnel_reportRun funnel analysis to track user progression.
Note: Funnel reporting uses the Data API v1alpha channel (the only channel where Google exposes it). Each step matches an event: set eventName per step, or omit it to use the step's name as the event name. For advanced matching, pass a full filterExpression.
Example:
ga_batch_run_reportsRun multiple reports in a single request.
Warning: Can return large datasets. Limit to 2-5 reports per batch.
ga_get_account_summariesGet all accessible accounts with their properties in a single compact call. The fastest way to discover account and property IDs.
ga_list_custom_dimensions / ga_list_custom_metricsList the custom dimensions and metrics defined for the property, including their API names (e.g., customEvent:plan_type) so you can use them in reports.
ga_list_key_eventsList the key events (conversions) configured for the property — useful before building conversion reports or deciding which events to send.
ga_list_google_ads_linksList Google Ads accounts linked to the property.
ga_check_compatibilityCheck whether a dimension/metric combination is valid before running a report, avoiding wasted requests and token-heavy error loops.
Example:
Good to know:
- Events take a few minutes to appear in standard reports, but show up almost immediately in the realtime report (
ga_run_realtime_report).- Use
ga_validate_eventto test new events without recording them.- If you omit
client_id, one is auto-generated per call. To have GA group several events (e.g., a cart-to-purchase flow) into the same session and user, pass the sameclient_idto every call.
ga_send_eventSend custom events to GA4.
Example:
ga_validate_eventValidate events before sending (uses debug endpoint).
ga_send_pageviewSend page view events.
Example:
ga_send_purchaseSend ecommerce purchase events.
Example:
ga_send_loginSend login events.
ga_send_signupSend user registration events.
ga_send_view_itemSend product/item detail view events. Completes the standard ecommerce funnel: view_item → add_to_cart → begin_checkout → purchase.
ga_send_add_to_cartSend add-to-cart events.
ga_send_begin_checkoutSend checkout initiation events.
ga_send_refundSend full or partial refund events. Use the same transaction_id as the original purchase; omit items for a full refund, include them for a partial one.
Example (partial refund):
See EXAMPLES.md for practical usage examples in Spanish.
Claude will use ga_run_report:
Claude will use ga_send_purchase:
Recommended before wiring up any new event: the debug endpoint checks the payload without recording anything.
Claude will use ga_validate_event:
The response lists validation messages; an empty list means the event is well-formed.
Track signups or logins that happen in your backend, where no JavaScript tag runs:
Claude will use ga_send_signup:
Send the same client_id on each call so GA groups the events into one session:
Claude will chain ga_send_add_to_cart → ga_send_begin_checkout → ga_send_purchase, reusing the client ID:
Measure things GA never sees natively, like AI agent activity or scheduled jobs:
Claude will use ga_send_event:
Combine both APIs to confirm your tracking works end to end:
Claude will call ga_send_event, then check with ga_run_realtime_report:
Measurement Protocol events appear in the realtime report within seconds, while standard reports can take a few minutes.
Enable debug logging by setting:
For Measurement Protocol, use ga_validate_event to check events before sending them live.
Contributions are welcome! Please feel free to submit a Pull Request.
MIT License - see LICENSE file for details.
For issues and questions:
See CHANGELOG.md for version history.