Google Analytics 4

Pull GA4 reports, audiences, and metrics into your AI client.

Works with: Claude DesktopClaude CodeCursor
Quick install
npx -y ga4-mcp-server

How to install the Google Analytics 4 MCP server

Add this to your Claude Desktop MCP configuration:

{
  "mcpServers": {
    "google-analytics": {
      "command": "npx",
      "args": [
        "-y",
        "ga4-mcp-server"
      ]
    }
  }
}

Add this to your Claude Code MCP configuration:

npx -y ga4-mcp-server

Add this to your Cursor MCP configuration:

{
  "mcpServers": {
    "google-analytics": {
      "command": "npx",
      "args": [
        "-y",
        "ga4-mcp-server"
      ]
    }
  }
}

The GA4 MCP server gives Claude direct access to your Google Analytics 4 data. Pull reports, ask why something changed, generate weekly summaries — all from plain-English prompts. For anyone running GA4, this is the highest-leverage analytics install in the directory.

GA4’s UI is dense and non-obvious. The MCP server side-steps that entirely. You ask the question, Claude writes the right Data API query, you get the answer.

Why use it

The reason most people don’t use GA4 effectively isn’t lack of data, it’s friction. Building a custom report takes a half-hour the first time and you forget how to do it the next time you need it. Each insight has a tax.

The MCP server removes the tax. “Compare landing-page conversions across these three sources, last 14 days vs the 14 before that” goes from a 20-minute UI session to a five-second prompt.

What it actually does

Run any standard GA4 report: pick metrics, dimensions, filters, date ranges. Run realtime reports for the last 30 minutes. Pull audience definitions and segment-level data. Some servers also expose the Admin API, which lets you list properties, streams, and custom dimensions.

Practical patterns:

  • “What were our top 10 landing pages by conversion rate last month?”
  • “Compare organic search traffic this week vs the same week last year, broken down by page.”
  • “Why is bounce rate up 8% on /pricing? Show me by source and device.”

Gotchas

GA4 has data sampling thresholds. For high-traffic properties, queries that return aggregated data over long windows can be sampled. The server returns the data Google gives it; Claude won’t know it’s sampled unless you ask. For exact numbers, set the date range smaller or use the Data API’s keepEmptyRows parameter.

Custom dimensions are property-specific. Claude can list them via the Admin API but won’t know what each one means in your business context. Add a brief description in your system prompt if custom dimensions matter for your workflows.

Pair with Search Console for the SEO loop: GSC for what people searched, GA4 for what they did after they landed. Claude can join the two in a single prompt: “what queries are bringing traffic that converts above average?”

For deeper data work where you need to join GA4 with your app database, pipe GA4 to BigQuery (built-in feature) and query both via the BigQuery MCP server. SQL gives you joins the GA4 UI can’t do.

Google Analytics 4 MCP server: FAQs

Is the GA4 server official?

No. Google hasn't shipped a first-party GA4 MCP server. The community implementations wrap the GA4 Data API and cover the main use cases.

What does it need to authenticate?

OAuth from your Google account, or a service account JSON file. Service accounts are usually the right choice: easier to scope, easier to revoke, and they don't tie the integration to a specific user's session.

What metrics can it pull?

Anything in the GA4 Data API: page views, sessions, users, conversions, custom events. Filters and dimensions work the same as in the GA4 UI. The most useful pattern is to write the query in plain English and let Claude translate it into the right Data API call.

Can it pull realtime data?

Yes, most servers expose the Realtime Reporting API endpoint. Note this is different from the standard reports and the data shape is more limited (last 30 minutes only, fewer dimensions).

How does this compare to Looker Studio or a custom dashboard?

The MCP server is for ad-hoc analysis: 'why did traffic dip yesterday?' Looker Studio is for recurring dashboards. They're complementary. Most teams want the dashboard for trends and the MCP server for diagnosis.