# Google Analytics 4 [Health: Active]

**Category:** 🎯 Marketing  
**Repository:** https://github.com/stucchi/mcp-google-analytics  
**GitHub Stars:** 0  
**Views:** 5  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/google-analytics-4-2

## Description
Manage GA4 properties, data streams, conversions, and run reports via Admin & Data APIs.

## Tools
Capabilities this server exposes over MCP:

- **check_auth_status** — Verify service account is configured and valid
- **list_accounts** — List accessible GA4 accounts
- **list_properties** — List properties for an account
- **create_property** — Create a GA4 property
- **get_property** — Get property details
- **delete_property** — Soft-delete a property
- **list_data_streams** — List data streams
- **create_web_data_stream** — Create web stream → get Measurement ID
- **delete_data_stream** — Delete a data stream
- **get_tracking_snippet** — Generate gtag.js HTML snippet
- **list_key_events** — List conversion events
- **create_key_event** — Mark event as conversion
- **delete_key_event** — Remove conversion
- **list_custom_dimensions** — List custom dimensions
- **create_custom_dimension** — Create custom dimension
- **list_custom_metrics** — List custom metrics
- **create_custom_metric** — Create custom metric
- **list_google_ads_links** — List Google Ads links
- **create_google_ads_link** — Link Google Ads account
- **get_measurement_protocol_secret** — Get/create Measurement Protocol secret
- **run_report** — Run report with dimensions, metrics, dates, filters
- **run_realtime_report** — Real-time active users and events
- **get_metadata** — List available dimensions and metrics

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `uvx` (confidence: high):

```json
"mcpServers": {
  "google-analytics-4": {
    "command": "uvx",
    "args": ["google-analytics-4-mcp"],
    "env": {
      "GA_CREDENTIALS": "",
      "GA_CREDENTIALS_PATH": ""
    }
  }
}
```

**Requires environment variables:** `GA_CREDENTIALS`, `GA_CREDENTIALS_PATH` — the values above are empty placeholders; fill in real credentials before running (see the repository for what each one is for).

## Documentation

## What Google Analytics 4 MCP server does

The Google Analytics 4 MCP server exposes administrative and reporting operations for Google Analytics 4 through MCP. It works with accounts, properties, data streams, key events, custom dimensions, custom metrics, Google Ads links, and Measurement Protocol secrets.

For new property setup, an agent can identify accessible accounts, create a property, add a web data stream, and retrieve the resulting Measurement ID. The server can also produce a gtag.js HTML tracking snippet for installation on a website. Existing resources can be inspected, and properties or streams can be soft-deleted or deleted through the available administration tools.

## How it works

Authentication uses a Google Cloud service account rather than an interactive browser session. The service account must have access to the relevant GA4 property, and the Google Analytics Admin API and Google Analytics Data API must be enabled in the associated Google Cloud project.

After the MCP process starts, call `check_auth_status` to verify the credentials. Account and property discovery can then precede configuration or reporting. `run_report` accepts dimensions, metrics, dates, filters, and a result limit for standard queries. `run_realtime_report` returns real-time active-user and event data, while `get_metadata` helps identify available dimensions and metrics.

## Setup and configuration

Create a service account in Google Cloud Console and download its JSON key. Grant the service account email Editor access under the GA4 property's Property Access Management settings. Enable both required APIs in the same Google Cloud environment.

Credentials can be supplied in `GA_CREDENTIALS` as the complete JSON document, or stored at the path specified by `GA_CREDENTIALS_PATH`. The environment variable takes precedence when both are present. The documented default file location is `~/.google-analytics-4-mcp/credentials.json`.

Running from source uses `uv run google-analytics-4-mcp` after cloning the repository.

## Tools and capabilities

The Google Analytics 4 MCP server includes tools for:

- Checking service-account authentication and listing accessible accounts or properties.
- Creating, reading, and deleting GA4 properties and data streams.
- Creating web streams, retrieving Measurement IDs, and generating gtag.js snippets.
- Listing, creating, and removing key events, custom dimensions, and custom metrics.
- Listing and creating Google Ads links.
- Getting or creating a Measurement Protocol secret.
- Running standard, real-time, and metadata queries through the Data API.

## Limitations and notes

The provided setup requires a Google Cloud service account, API enablement, and explicit GA4 property access. The documented credential flow does not use a browser consent screen or refreshable user tokens. Administrative changes include destructive operations such as property soft deletion and stream deletion, so agents should confirm targets before invoking them. The available report dimensions and metrics depend on the metadata exposed by the connected GA4 property and API.

_Full upstream README: https://allmcps.com/mcp/google-analytics-4-2/readme_

