Black Friday50% off Pro with BLACKFRIDAY
SEO

Google Analytics MCP: how to connect GA4 to Claude and ChatGPT

A step by step guide to Google's own Google Analytics MCP server: the Cloud project, APIs and credentials it needs, the config for each client, the errors people hit, the hosted options if you would rather sign in, and prompts that work well.

Jesse Sibley
By , FounderPublished · Last updated · 11 min read

This guide sets up Google's official server, googleanalytics/google-analytics-mcp, step by step, then covers its common errors and the prompts that work best. You can ask it about sessions, conversions, revenue and engagement by channel, campaign, landing page or date. If you would rather sign in than manage a Cloud project, hosted GA4 MCP servers are covered after the setup.

Want GA4 in Claude or ChatGPT in two minutes, with no Cloud project? Connect Manifold's hosted GA4 MCP server and sign in with Google. Analytics calls cost 0 credits.

What is the Google Analytics MCP server?

A Google Analytics MCP server bridges your AI agent and the Google Analytics APIs. You ask a question in plain language about sessions, conversions or revenue, and your agent calls the right Analytics tools to fetch the data. Google introduces its server on the Google Analytics developer site and keeps the code and setup instructions in the GitHub README. The README lists seven tools:

  • Account and property information: get_account_summaries, get_property_details, list_google_ads_links
  • Core reports: run_report, run_funnel_report, get_custom_dimensions_and_metrics
  • Realtime reports: run_realtime_report

None of them change your GA4 settings. Google's developer page says the server handles read requests only.

There are three realistic ways to connect GA4 to your agent (people also call this a GA4 MCP):

Diagram: the three ways to connect GA4 to your agent, comparing official server, hosted vendors, and Manifold
Official Google Analytics MCP server, hosted vendors, and Manifold: where each runs, setup steps, and cost.
  1. Google's official server: runs locally, needs a Google Cloud project and Application Default Credentials. Covered step by step below.
  2. Hosted vendors such as Stape, Composio and Windsor.ai: they run the server and handle the Google Cloud side, and you sign in with Google.
  3. Manifold: a hosted marketing MCP server with GA4 next to Search Console, SEO and AI visibility data.

The last two are covered briefly after the setup.

How to set up the official Google Analytics MCP server

1. Create a Google Cloud project

Open console.cloud.google.com, create a project, and note its project ID.

2. Enable both APIs

In your Cloud project, enable the Analytics Admin API and the Analytics Data API.

Without both, the server fails with "API not enabled" errors.

3. Set up credentials

Install pipx, then set up Application Default Credentials for a Google user who can see your GA4 property. The README asks for the Analytics scope plus the Cloud platform scope, using an OAuth client JSON you create in your Cloud project:

Terminal
gcloud auth application-default login \
  --scopes https://www.googleapis.com/auth/analytics.readonly,https://www.googleapis.com/auth/cloud-platform \
  --client-id-file=YOUR_CLIENT_JSON_FILE

The command prints the path of the saved credentials file. Copy it, because every client config below needs it as GOOGLE_APPLICATION_CREDENTIALS. The README also shows a variant that impersonates a service account.

4. Check GA4 access

The credentials only see what that Google user (or service account) can see. If the account is not on the property yet, open Admin → Property access management in Google Analytics, click +, and add it with the Viewer role.

Without access, the server returns "Permission denied" on every Analytics call.

5. Test the server

Terminal
pipx run analytics-mcp

If it starts without a credentials error, stop it and add it to your client.

6. Connect in Claude Desktop

Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

JSON
{
  "mcpServers": {
    "analytics-mcp": {
      "command": "pipx",
      "args": ["run", "analytics-mcp"],
      "env": {
        "GOOGLE_APPLICATION_CREDENTIALS": "PATH_TO_CREDENTIALS_JSON",
        "GOOGLE_PROJECT_ID": "YOUR_PROJECT_ID"
      }
    }
  }
}

Replace the two placeholders with your credentials path and Cloud project ID, then restart Claude. The server appears under Settings → Developer.

7. Connect in Claude Code

The README's command:

Terminal
claude mcp add analytics-mcp \
  --scope user \
  -e "GOOGLE_APPLICATION_CREDENTIALS=PATH_TO_CREDENTIALS_JSON" \
  -e "GOOGLE_PROJECT_ID=YOUR_PROJECT_ID" \
  -- pipx run analytics-mcp

Then run /mcp in Claude Code to check it is connected.

8. Connect in Gemini CLI

The official README shows the Gemini CLI config. Create or edit ~/.gemini/settings.json:

JSON
{
  "mcpServers": {
    "analytics-mcp": {
      "command": "pipx",
      "args": ["run", "analytics-mcp"],
      "env": {
        "GOOGLE_APPLICATION_CREDENTIALS": "PATH_TO_CREDENTIALS_JSON",
        "GOOGLE_PROJECT_ID": "YOUR_PROJECT_ID"
      }
    }
  }
}

9. Connect in Cursor

Add the same entry to ~/.cursor/mcp.json (or the project's .cursor/mcp.json):

JSON
{
  "mcpServers": {
    "analytics-mcp": {
      "command": "pipx",
      "args": ["run", "analytics-mcp"],
      "env": {
        "GOOGLE_APPLICATION_CREDENTIALS": "PATH_TO_CREDENTIALS_JSON",
        "GOOGLE_PROJECT_ID": "YOUR_PROJECT_ID"
      }
    }
  }
}

Does it work with ChatGPT?

Not directly. The official server runs locally, and ChatGPT and claude.ai on the web connect to MCP servers over public HTTPS, so they cannot reach it without a tunnel in front of it. Use a local client, or one of the hosted options below.

Troubleshooting the official server

Error: Credentials not found

Cause: No credentials set, or the wrong path.

Fix: Run the gcloud auth application-default login command above, and check that GOOGLE_APPLICATION_CREDENTIALS in your client config points to the file it saved.

Error: API not enabled

Cause: One or both Analytics APIs are not enabled in your Cloud project.

Fix: Enable the Analytics Admin API and Analytics Data API.

Error: Permission denied

Cause: The account (your user or the service account) lacks GA4 access.

Fix: Open Admin → Property access management in Google Analytics and add the email with Viewer role.

Error: Wrong property ID

Symptom: "Property not found" or empty results.

Fix: Ask the server for your account summaries first and copy the property ID from there. GA4 property IDs are numbers, written properties/123456789 in the API.

Who it fits

You already work with Google Cloud, know how to enable APIs and manage credentials, want Google's own code with no third party, and use a local client such as Claude Code, Claude Desktop, Gemini CLI or Cursor.

If you would rather not run it yourself

Hosted servers run the Google Cloud side for you. You sign in with Google instead of creating a project and credentials, and they work from ChatGPT and claude.ai on the web.

Stape says its GA4 server is free, Composio has a free tier, and Windsor.ai can put Search Console and Google Ads in the same conversation on a paid plan. Manifold's hosted GA4 MCP puts GA4 next to Search Console, SEO and AI visibility data on one server, with no realtime or funnel reports.

Check each one's pricing and limits before you commit.

What to ask once it's connected

Here are prompts for common Analytics jobs. They work with any of the servers above; the tool names are the official server's.

Sessions and conversions by channel

"Show sessions and key events by channel for property 123456789, last 28 days versus the previous 28 days."

Tools: run_report with sessions, key events and the default channel group, over two date ranges.

What you get: A table with current and previous sessions and conversions per channel (Organic Search, Direct, Paid Search, etc.), so you can see which channels grew or dropped.

Top landing pages for organic traffic

"What were the top 20 landing pages for organic traffic last month? Include sessions and bounce rate."

Tools: get_account_summaries to find the property, then run_report with sessions, bounce rate and landing page, filtered to the Organic Search channel.

What you get: A ranked list of your organic landing pages and how visitors behaved there.

Traffic drop diagnosis

"Sessions dropped 30% last week. Break it down by channel, then by landing page within organic. What changed?"

Tools: run_report with two date ranges (this week against last), first by channel, then by landing page filtered to organic.

What you get: Whether the drop was across all channels or one (for example organic fell while paid stayed flat), and which pages lost the most traffic.

Checkout funnel

"Show the funnel from view_item to add_to_cart to begin_checkout to purchase for last month, by device category."

Tools: run_funnel_report.

What you get: How many users reach each step and where they drop off, split by device.

Right now

"How many active users are on the site right now, and on which pages?"

Tools: run_realtime_report.

What you get: Live users by page, useful during a launch or a campaign send.

Conversions by campaign

"Show conversions by campaign last 30 days, sorted by conversion rate."

Tools: run_report with key events, sessions and campaign name. The agent then calculates conversion rate.

What you get: A ranked list of your campaigns and which converted best.

Revenue by source and medium

"What was revenue by source and medium last quarter?"

Tools: run_report with total revenue, source and medium.

What you get: A breakdown of where your revenue came from: organic, paid, social, email, referral, etc.

Custom dimensions and metrics

"List all custom dimensions and metrics for property 123456789."

Tools: get_custom_dimensions_and_metrics.

What you get: Your custom dimensions and metrics with their API names, ready to use in reports.

Pairing GA4 and Search Console

"Show GA4 organic sessions by landing page last 28 days, then Search Console clicks and impressions by page for the same dates. List pages with over 100 clicks but under 50 sessions."

This one needs Search Console on the same server, or a second server for it, because the official server sees only GA4.

What you get: Pages where Google delivered clicks but visitors bounced or did not register sessions, often because the page did not match the title and snippet promise.

Limits and gotchas

Report size

One Google Analytics Data API report takes at most 10 metrics and 9 dimensions. If you need more, split it into several reports.

Data thresholding

Google applies thresholding to GA4 reports when the number of users in a segment is too small, to protect user privacy. Small row counts may be withheld or aggregated.

Data settling

GA4 data can take a day or more to settle, so yesterday's numbers may still move. For totals you will compare later, end the range a couple of days back.

LLMs doing arithmetic

When you ask for a calculated metric like conversion rate or revenue per session, the agent fetches the raw numbers and calculates it. LLMs can make arithmetic mistakes on large numbers. Check the math yourself when it matters.

The official server sees only GA4

The official Google Analytics MCP server covers GA4 only. It cannot read Search Console or Bing. If you want those next to Analytics, use a hosted server that has both, such as Manifold's Google Search Console MCP server, which shares one Google connection with Analytics. For Search Console options on their own, see the best Google Search Console MCP servers.

Run this in your agent

Connect Manifold to Claude, ChatGPT or Cursor, then paste this prompt.

List my Analytics properties, then show sessions and key events by channel last 28 days versus the previous 28 days. Then pull Search Console clicks by page for organic traffic in the same period. Which pages had clicks but low sessions?

Questions people ask

How do I connect Google Analytics to Claude?

With Google's official server: create a Google Cloud project, enable the Analytics Admin and Data APIs, run gcloud auth application-default login with the analytics.readonly scope, then add pipx run analytics-mcp to Claude Code or Claude Desktop with GOOGLE_APPLICATION_CREDENTIALS and GOOGLE_PROJECT_ID set. For claude.ai on the web, use a hosted GA4 MCP server and sign in with Google.

Is there an official Google Analytics MCP server?

Yes. Google publishes an experimental Python server at github.com/googleanalytics/google-analytics-mcp. You run it locally with pipx run analytics-mcp. It needs a Google Cloud project with the Analytics Admin API and Data API enabled, and Application Default Credentials for a Google user who can see your GA4 property.

What tools does the Google Analytics MCP server have?

Seven, per the README: get_account_summaries, get_property_details and list_google_ads_links for account and property information; run_report, run_funnel_report and get_custom_dimensions_and_metrics for core reports; and run_realtime_report for realtime data.

Does the Google Analytics MCP server work with ChatGPT?

The official server runs locally on your machine, so it works with any client on the same machine: Claude Desktop, Claude Code, Gemini CLI and Cursor. ChatGPT connects to MCP servers over public HTTPS, so the local server does not work from ChatGPT or claude.ai on the web unless you put a tunnel in front of it. Hosted vendors and Manifold work from ChatGPT and claude.ai.

Is the Google Analytics MCP server free?

The official server is free and runs on your own Google Cloud project. Hosted vendors set their own pricing; Stape says its GA4 server is free. On Manifold, the Analytics tools cost 0 credits, like the Search Console and Bing tools, and every account gets 250 free credits a month for the paid tools, with Pro from $29/mo.

Can a Google Analytics MCP server change my GA4 settings?

The official server's tools run reports and read account and property details; none of them change GA4 settings. Manifold's Analytics tools list properties, list fields and run reports. Whichever server you use, a Viewer role on the property is enough for reporting.

Can I pair Google Analytics with Search Console in one chat?

Not with the official server alone, which sees only GA4. Use a hosted server that includes both, such as Manifold or Windsor.ai, or add a Search Console server next to it. Then you can pair organic sessions from Analytics with clicks and impressions from Search Console for the same dates.

Sources

Jesse Sibley

Jesse Sibley

Founder of Manifold. A growth engineer who has worked with London startups for eight years.

All SEO guides
  • 16 min read

    Keyword clustering with Claude: group keywords by SERP overlap

    Connect Manifold MCP, have your agent pull volumes and the top 10 for each keyword, measure overlap, name clusters, map to existing pages, then track head terms with a rank monitor.

  • 16 min read

    Find keyword cannibalization with Claude

    Connect Search Console, group query and page rows by query, check the live SERP and both pages, pick one owner per query, then track with a weekly rank monitor that reports when a different page ranks.

  • 6 min read

    Claude plugins vs skills vs MCP

    What a Claude plugin, skill, connector and MCP each add, how those words work in ChatGPT, and one marketing job with Manifold MCP.