Google Analytics MCP: how to connect GA4 to Claude

Google's official GA4 MCP server runs on your computer and gives Claude read-only access to your reports. Here's the setup, and what GA4 can't tell you about why buyers leave.

Raphael Gonzalez, Founder, Anry. Prices checked October 2026
QuestionAnswer
What is it?Google's own MCP server for GA4, labelled "experimental"
Who makes it?Google Analytics, open source at googleanalytics/google-analytics-mcp
Where does it run?On your computer, started by pipx. Google doesn't host a URL for it
Works inClaude Code, Claude Desktop, Cursor, Gemini CLI. Not Claude on the web
Read or write?Read only. It "can't edit your Google Analytics configuration or settings"
LimitsThe GA4 Data API quota: 200,000 tokens a day per standard property
What it can't seeWhat a visitor did between landing and leaving, and Shopify's own order records

What the GA4 MCP server does

It lets Claude run GA4 reports for you. You ask in plain words, and Claude picks the dimensions and metrics and calls the GA4 Data and Admin APIs. Google says it's "available for read requests only" (Google for Developers), and the login it asks for uses the analytics.readonly scope.

It has seven tools (GitHub):

ToolWhat it does
get_account_summariesLists your GA accounts and properties
get_property_detailsDetails of one property
list_google_ads_linksThe Google Ads accounts linked to a property
run_reportAny standard report: users, sessions, revenue, by page, source, device, country
run_funnel_reportA step-by-step funnel, for example product view to purchase
get_custom_dimensions_and_metricsThe custom fields set up on a property
run_realtime_reportWhat's happening on the site right now

The package is analytics-mcp on PyPI, version 0.7.0 since 29 July 2026 (PyPI). The first version reached PyPI in August 2025, and Google still calls it experimental, so expect changes.

Before you start

  • GA4 access. The Google account you log in with has to see the property. On Shopify, GA4 is usually connected through the Google & YouTube sales channel (Shopify Help).
  • A Google Cloud project with the Google Analytics Admin API and the Google Analytics Data API turned on. Any project works. It's the project your API calls run under.
  • Python 3.10 or newer and pipx. The server is a Python package that pipx downloads and starts.
  • The gcloud CLI and an OAuth client file. Create a desktop OAuth client in your Cloud project and download its JSON. gcloud uses it to sign you in.

You don't need an API key or a GA4 360 plan.

Set it up in Claude Code

Google's README gives a Claude Code command, so this is the shortest route.

  1. In the Cloud console, enable the Google Analytics Admin API and the Google Analytics Data API for your project.

  2. Install pipx if you don't have it.

  3. Sign in with the account that can see your GA4 property:

    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
    
  4. Copy the credentials file path that gcloud prints when it's done.

  5. Add the server, with your path and project ID:

    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
    
  6. Start Claude Code, run /mcp, and check analytics-mcp is connected.

  7. Ask "what can the analytics-mcp server do?" Then ask for details on your property by name.

The commands are from the README. --scope user makes the server work in every project (Claude Code docs).

Claude Desktop

Google's README has no Claude Desktop example, but Desktop loads local servers the same way. Open Settings, then Developer, then Edit Config, and add this to claude_desktop_config.json (MCP docs):

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

The command, args and env are the ones Google gives for Gemini CLI. Quit Claude Desktop fully and reopen it.

Cursor

Paste the same block into ~/.cursor/mcp.json. Cursor reads command, args and env in that format (Cursor docs).

What to ask once it's connected

Start a store's first chat with the questions GA4 handles well:

  • "Run a funnel for the last 30 days, from product view to add to cart to checkout to purchase, split by mobile and desktop."
  • "Which landing pages had the lowest engagement rate from paid social last week?"
  • "Compare purchases and revenue by source and medium for the last 28 days against the 28 before."
  • "How many people are on the site right now, and on which pages?"
  • "Which Google Ads accounts are linked to this property?"

The funnel shows which step loses the most people, by device, in one answer.

What GA4 can't tell you about why buyers leave

GA4 is built to count, and the MCP inherits its blind spots. Four matter for a store.

"Engaged" is a low bar. A session counts as engaged if it lasts longer than 10 seconds, has a key event, or views 2 or more pages (GA4 Help). A visitor who sits on your product page for 12 seconds without touching it is engaged.

Scroll is all or nothing. The built-in scroll event fires only when someone reaches 90% of the page (GA4 Help). Someone who scrolled halfway to your size picker and left looks the same as someone who never moved.

You get tables, not visits. The Data API returns reports made of dimensions and metrics (Google for Developers). Raw events per visitor live in the BigQuery export, which caps standard properties at 1 million events a day (GA4 Help). Low-traffic rows can also be hidden by data thresholds (GA4 Help), and with consent mode, part of your users can be modeled rather than observed (GA4 Help).

Purchases are a browser event. GA4 counts a purchase when its tag fires. Shopify records the order on its own servers. Ruler Analytics, an attribution vendor, names ad blockers and cookie settings as the most common causes of the gap (Ruler).

Here's why the scroll point matters, from our own site. In October 2026 we paid Meta for 460 landing page views on anry.io. Anry saw that roughly 98% of those visitors left the page untouched, with no scroll and no tap, and that nearly all of them arrived from Reels and Stories on Instagram. GA4's default scroll event can't separate a visit that never moved from one that scrolled 80%. We paused the campaign the same day.

Here's how GA4's tools line up with Anry's (tool names from the Anry MCP docs):

You want to knowGA4 MCPAnry MCP
Which properties or stores can I see?get_account_summarieslist_sites, get_site_status
How does traffic and the funnel look?run_report, run_funnel_reportget_analytics_overview, get_top_pages, get_traffic_sources
What happened in one visit?No toollist_sessions, get_session
How far did people scroll, and what did they click?90% scroll event onlyget_heatmap_summary
Which ads cost money without orders?Google Ads only, if linkedget_campaign_spend, get_paid_waste_summary
Where is revenue leaking, and how much?No toollist_opportunities, get_revenue_leaks, get_issue
What did we find last week?No toollist_reports, get_report, list_questions
What's happening right now?run_realtime_reportNo tool

GA4 wins on realtime and on the sheer range of reports. Anry wins on the single visit and the price of a leak.

GA4 MCP vs Anry vs a BigQuery export

GA4 MCPAnry MCPGA4 BigQuery export
Traffic, sources, funnelsYesYesYes, if you write SQL
One visit, step by stepNoYesRaw events, you rebuild it
Ad spend joined to store ordersNoYes, Meta and GoogleNo
A $ figure per leakNoYesNo
Runs whereYour computerRemote, OAuth sign-inGoogle Cloud
CostOpen source, Data API quotasMonthly plan, priced by trafficBigQuery charges past the sandbox limits

Prices checked October 2026.

For questions about traffic, sources and funnel steps, the GA4 server does the job, and all it asks for is a Cloud project. For what GA4 leaves out, here's how the other ecommerce analytics tools split the work.

Is it safe?

The login asks only for the analytics.readonly scope plus cloud-platform, and Google says the server can't edit your GA4 configuration or settings. It runs on your machine. Your report data does go to the model you connect, so treat it like any GA4 export.

To disconnect, gcloud auth application-default revoke cancels the gcloud login and removes the credentials file from your machine (gcloud reference). For how MCP servers work in general, local versus remote, see what is an MCP server.

Common errors and the fix

SymptomLikely causeFix
403 about insufficient authentication scopesThe gcloud login didn't include both scopesRerun the login command with analytics.readonly and cloud-platform
Error saying the Analytics Data API is disabledThe API isn't enabled in the project you set as GOOGLE_PROJECT_IDEnable both Analytics APIs in that project
No properties come backYou signed in with a Google account that can't see GA4Log in again with the account that has access
analytics-mcp doesn't appear in Claude DesktopThe config didn't load: a typo, a relative path, or Claude still runningValidate the JSON, use absolute paths, quit and reopen, then read mcp-server-analytics-mcp.log in ~/Library/Logs/Claude
Tool calls hang on WindowsAn old bug with gcloud's default credentials pathUpdate to 0.6.0 or later, or copy the credentials file elsewhere and point to the copy (issue #156)

Also watch the quota. A standard property gets 200,000 Data API tokens a day and 40,000 an hour, with 10 requests at once (Google for Developers). A long chat with many reports eats into the hourly figure.

Where Anry fits

GA4 counts the people who left. Anry shows where they left, why, and what it cost you. It ties each Meta or Google ad click to its session and to any order, spots the leak (a page, a device, or an ad bringing the wrong crowd) and values it from your store's own sales. None of its tools can change anything, and "Ask Anry" passes the fix to your agent.

If your question is "how many" rather than "why", GA4's server is all you need. When people leave and you can't see why, our traffic but no sales guide has the order to check things in.

Frequently asked questions

Is there an official Google Analytics MCP server?

Yes. Google Analytics publishes it on GitHub as googleanalytics/google-analytics-mcp. It's open source, read-only, and still labelled experimental.

Can Claude change my GA4 settings through it?

No. Google says the server is for read requests only and can't edit your configuration or settings. The login scope is read-only.

Does the GA4 MCP work in Claude on the web?

No. claude.ai only connects to remote servers (Claude Help), and Google's README only describes running it locally. Use Claude Desktop, Claude Code or Cursor.

Why doesn't GA4 revenue match Shopify?

GA4 counts a purchase when its tag fires in the browser, which blockers and consent choices can stop. Shopify records every order on its servers. Trust Shopify for the order count.

Sources

See which ad clicks leave your store before they buy.

14-day free trial, no card. Works in Claude, Claude Code and Cursor.

Start free trial