Scalewell / Blog

GA4 MCP: how to connect Claude to Google Analytics for paid media analysis

A setup guide to Google's official Google Analytics MCP server and the hosted alternatives, with a decision rule and the questions a paid team should and should not ask GA4.

Illustration of a translator connecting an AI chat window to a vault of analytics data, with a separate CRM cabinet out of reach.

A GA4 MCP server lets an AI client such as Claude query your Google Analytics 4 property in plain English. Google publishes a free, official Google Analytics MCP server that runs with your Google Cloud credentials, and hosted connectors offer a sign-in-with-Google alternative. For paid teams it answers what happened after the click, and it can't see your CRM.

You know the Monday routine. Someone asks why paid social sessions dropped 30% last week, and you spend twenty minutes building an exploration to find out it was one broken UTM on a retargeting campaign. A GA4 MCP connection turns that into a question you type, which is a real saving. It also makes it very easy to get a confident answer from data that was thresholded, sampled or attributed in a way the model never mentions.

This guide is for the head of paid media or PPC lead who wants the connection working this week. It covers the routes that exist as of November 2026, the exact setup for Claude, a decision rule for choosing, and the part most setup guides skip: which questions GA4 can answer honestly and which it can't.

A GA4 MCP server turns questions into Data API calls

A GA4 MCP server is a small program that sits between your AI client and two Google APIs: the Google Analytics Admin API, which describes accounts and properties, and the Google Analytics Data API, which runs reports. The Model Context Protocol (MCP) is the standard that lets Claude, ChatGPT, Cursor and other clients discover those tools and call them.

So when you ask "which campaigns drove the most key events from organic and paid search last month", the model picks a tool such as run_report, fills in dimensions, metrics and a date range, and reads the rows back. It can't see anything a GA4 report couldn't. Think of it as a very fast analyst who has read access to your property and nothing else, which is exactly why the limits later in this article matter. Scalewell helps paid and demand gen teams make a connection like this part of the week, so Monday's campaign questions get answered from the data itself.

An AI chat console connects through a middle connector and two cables to a GA4 analytics reservoir, while a separate CRM island stays unconnected.
The AI client (Claude, ChatGPT or Gemini) sits on the left, and the GA4 MCP server sits in the middle. The server calls two APIs: the Google Analytics Admin API for accounts, properties and key events, and the Google Analytics Data API for reports and realtime data. Both point to your GA4 property. Your CRM sits apart, with no connection from the GA4 server, because that is where pipeline lives.

If you've already set up the Google Ads MCP, the shape will feel familiar. The difference is the data: Google Ads knows spend and clicks, while GA4 knows what visitors did on your site afterwards.

Google's official server is free and read-only by default

Google's official Google Analytics MCP server is open source under the Apache 2.0 license, lives at github.com/googleanalytics/google-analytics-mcp and installs from PyPI as analytics-mcp. Its first release went up in August 2025, and it reached version 1.0.0 on November 3, 2026, followed by 1.1.0 on November 6, according to the PyPI release history.

The tools in the current README fall into four groups:

GroupToolsWhat a paid team uses it for
Account and propertyget_account_summaries, get_property_details, list_google_ads_links, list_property_annotations, list_key_eventsFinding the right property, checking which Google Ads accounts are linked, reading which events count as key events
Core reportsrun_report, run_funnel_report, run_conversions_report, get_custom_dimensions_and_metricsChannel and campaign performance, funnel drop-off, ad cost and ROAS by attribution model
Realtimerun_realtime_reportChecking a launch or a tracking fix is firing
Optional writescreate_property_annotation, create_custom_dimension, create_key_eventOff unless you pass --allow-write and grant the analytics.edit scope

Two details are worth knowing before you rely on it. Google's developer page for the server still says it "can't create, modify, or delete your Google Analytics configuration or settings", while the GitHub README now documents the three write tools above behind a flag. Leave the flag off and both descriptions hold.

The second detail is run_conversions_report. It calls a part of the Data API that Google's conversion reporting guide says is "only available in the v1alpha version" and "may not be available to your Google Analytics property". It supports two attribution models, DATA_DRIVEN and LAST_CLICK. If the tool errors on your property, that's probably why.

Authentication runs through Google Cloud. You enable the Admin API and Data API in a Cloud project, then create Application Default Credentials (ADC) with the analytics.readonly scope for a Google account that has at least the Viewer role on the property. The server itself costs nothing; the Data API quotas described below are the real limit.

Claude connects to Google's server in seven steps

Connecting Claude to GA4 through the official server is mostly Google Cloud work, done once. These steps follow the README and Google's setup page as of November 2026.

  1. Install Python 3.10 or later and pipx. On a Mac with Homebrew, brew install pipx works. Check it worked with pipx --version.
  2. Pick or create a Google Cloud project. Note its project ID; you'll pass it as GOOGLE_CLOUD_PROJECT.
  3. Enable two APIs in that project: the Google Analytics Admin API and the Google Analytics Data API, from the API library in the Cloud console.
  4. Create an OAuth client of the desktop (or web) type in the same project and download its JSON file. This lets you sign in as yourself.
  5. Create your credentials. Run the command below, sign in with the Google account that can see the GA4 property, and copy the file path it prints after "Credentials saved to file".
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
  1. Add the server to Claude. In Claude Code, run the command below with the real path and project ID.
claude mcp add analytics-mcp \
  --scope user \
  -e "GOOGLE_APPLICATION_CREDENTIALS=PATH_TO_CREDENTIALS_JSON" \
  -e "GOOGLE_CLOUD_PROJECT=YOUR_PROJECT_ID" \
  -- pipx run analytics-mcp

For Claude Desktop, add the same command, arguments and two environment variables to claude_desktop_config.json under mcpServers (Settings, then Developer, then Edit Config), and restart the app. Google's troubleshooting notes say desktop apps often need the absolute path to pipx and an absolute credentials path, because ~ and $HOME don't expand there.

  1. Test with a dull question first. Ask "list my Google Analytics accounts and properties". If you get a 403, Google's page lists the usual causes: an API not enabled, missing Viewer access, or the wrong scopes.

Claude.ai in the browser and ChatGPT can't reach a server running on your laptop. Both need a server they can reach over the internet: Claude through custom connectors, which must be "reachable over the public internet from Anthropic's IP ranges" and are available on every plan with Free limited to one, and ChatGPT through its custom MCP setup, which OpenAI's connection guide says requires "a public HTTPS endpoint" or its Secure MCP Tunnel. Google's README covers hosting the server on Cloud Run with --transport http, and its built-in --oauth option lets each person sign in with their own Google account. That's a job for someone comfortable with Cloud Run.

The other routes trade control for setup time

Besides Google's own server, you'll find hosted connectors and community servers. Each one below was checked against its own page on November 9, 2026.

RouteRuns whereReadsWritesSign-inCost (as published)
Google's server, localYour machineTen read tools across property, report and realtimeThree, behind a flagYour Cloud project's credentialsFree
Google's server on Cloud RunYour Cloud projectSameSamePer-user Google OAuthFree software; you pay Cloud Run
StapeStape's hosted endpointNine read tools, Google's set minus list_key_eventsNone, all tools read-onlyGoogle OAuthFree
Windsor.aiWindsor's serversGA4 plus Windsor's other connectorsNone for GA4Windsor account, connect GA4 onceFree plan for one source; paid from $19 a month billed annually
MarkifactMarkifact's serversGA4 reports, plus Google Ads and othersKey events, custom dimensions, audiences, channel groups and more, each waiting for approvalGoogle OAuthPro from $79 a month, trial credits free
Community servers such as surendranb/google-analytics-mcpYour machineVaries by projectVariesUsually your own credentialsFree, MIT licensed

A hosted connector means your GA4 access token sits with a third party. For most marketing data that's an acceptable trade, but check it with whoever owns your Google Analytics account before connecting a client property. Community servers are fine to read, and you should read their code before giving them credentials, because nobody at Google reviews them.

One more thing you may come across: a Google-run endpoint at analyticsdata.googleapis.com/mcp/v1 answers MCP handshakes, but Google's reference page for it returned a 404 error on November 9, 2026. Treat it as unannounced until Google documents it.

Three questions decide the route

Three questions, asked in this order, choose the route for most paid teams.

  1. Will one person use it from Claude Code or Claude Desktop? Use Google's server locally. It's free, it's Google's code, and the setup above is a one-time cost.
  2. Does the whole team need it in the browser, or in ChatGPT? If you have someone who can run a Cloud Run service, host Google's server with --oauth so each person signs in as themselves. If you don't, a hosted read-only connector such as Stape or Windsor gets you there in minutes.
  3. Do you want the AI to change GA4 settings, such as key events or custom dimensions? Most paid teams shouldn't, because a wrongly marked key event changes your reporting and, if key events are imported into Google Ads, what bidding counts as a conversion. If you do, use a route that asks for approval on every change, and read our view on keeping humans in the loop on ad spend first.

GA4 answers on-site questions and guesses at pipeline

The questions GA4 answers well through MCP are the ones about traffic and behavior after the click. The questions it answers badly are the ones a CFO actually asks.

Ask GA4 thisBe careful asking GA4 this
Which paid campaigns sent sessions that bounced, by landing pageWhat did LinkedIn return in pipeline
Did the form submit event fire on the new landing page this morningWhich channel deserves more budget next quarter
How sessions and key events compare between two date ranges, by source and mediumWhich campaign was first touch for this deal
Which UTM values look broken or inconsistentHow many sales-qualified opportunities came from paid search
Funnel drop-off from pricing page to demo formWhat's our true cost per opportunity

The gap comes from what each system stores. GA4 counts key events such as form fills; whether that form became an opportunity lives in your CRM. If the question is about pipeline, connect the CRM instead, which is what our HubSpot MCP guide covers. A GA4 report showing 400 leads is silent on what sales did with any of them.

There's also a B2B wrinkle on cost. GA4 shows Google Ads cost when the accounts are linked, and Google's campaign data import pulls cost automatically from Meta, Pinterest, Reddit, Snap and TikTok. LinkedIn isn't on that list, so unless you upload LinkedIn spend by file or Google Sheets, any ROAS or cost question about LinkedIn will come back empty or wrong. Ask the LinkedIn Ads MCP for spend and GA4 for what happened on site.

Four GA4 limits produce confident wrong answers

GA4 applies thresholds, sampling, a narrow set of attribution models and API quotas, and an AI client won't mention any of them unless you ask. This is the awkward part, and it's where a fast answer can do more damage than a slow one.

Thresholds hide rows. Google says data thresholds withhold data "to prevent anyone viewing a report or exploration from inferring the identity" of users, and that rows may be withheld when there are low user or event counts in the date range. Narrow B2B segments, such as one campaign in one country for one week, are exactly where this bites. The Data API flags it with a subjectToThresholding field in the response metadata.

Sampling scales up a portion. Google's sampling page sets the event-level query limit at 10 million events for standard properties. Past that, GA4 analyzes part of the data and scales it, and the Data API reports it in samplingMetadatas. A small property may never reach it, while a year of data with several dimensions on a busy site can.

Attribution offers three models. GA4's attribution models are data-driven, paid and organic last click, and Google paid channels last click. First click, linear, time decay and position-based were removed in November 2023. If the model offers you "linear attribution by channel", it's describing something GA4 no longer computes.

Quotas cap one project's share. The Data API quotas give a standard property 200,000 tokens a day and 40,000 an hour, but a single Cloud project can use only 14,000 of those hourly tokens. An agent that loops through 50 campaigns one report at a time can run out mid-analysis, so ask for one report with campaign as a dimension instead.

The practical fix for all four is a standing instruction. Paste this at the start of a session, or save it as a project instruction in Claude:

When you query Google Analytics:
1. Tell me the property ID, date range, dimensions and metrics you used.
2. Check the response metadata. If subjectToThresholding is true, if samplingMetadatas is present, or if dataLossFromOtherRow is true, say so before giving any numbers.
3. State the attribution model behind any conversion or key event figure. Only data-driven and last click models exist in GA4.
4. Use one report with several dimensions rather than many small reports.
5. Never estimate pipeline, opportunities or revenue that GA4 does not report. Say the CRM is needed.
6. LinkedIn cost is not in GA4 unless we imported it. Do not compute LinkedIn ROAS from GA4 alone.

Six starter prompts cover a paid team's first week

These prompts work as a first week's set, and each one maps to a single GA4 report:

1. List the Google Ads accounts linked to property [ID] and the key events defined on it.
2. Compare sessions, engaged sessions and key events by session source / medium for the last 7 days against the previous 7. Flag anything that moved more than 20%.
3. Show sessions by session campaign where the source is linkedin for the last 30 days, and list campaign values that look like typos or missing UTMs.
4. For paid search landing pages in the last 30 days, show sessions, engagement rate and form_submit key events. Sort by sessions.
5. Run a realtime report for the last 30 minutes filtered to the event generate_lead.
6. Run a funnel from /pricing to /demo to the generate_lead event for the last 28 days, split by device category.

Imagine a team whose demo requests from paid search fell by a third in a week. Prompt 2 shows the drop is concentrated in one source; prompt 4 shows one landing page's engagement rate collapsed; prompt 5 confirms the lead event isn't firing there. That hypothetical diagnosis takes three questions instead of an afternoon in explorations, and you still check the page yourself before telling anyone. Our PPC reporting guide covers what to do with the numbers once you trust them.

First-week problems are mostly configuration

Most first-week failures are configuration, and they're fixable in minutes once you know where to look.

  • Wrong Google account. ADC uses whichever account you signed in with in step 5. If that account can't see the property, the server returns nothing useful. Re-run the login.
  • Missing quota project. A 403 mentioning a quota project or ACCESS_NOT_CONFIGURED usually means GOOGLE_CLOUD_PROJECT isn't set.
  • The model invents metric names. Ask it to call get_custom_dimensions_and_metrics first, so it works from the property's real schema rather than guessing.
  • Expired credentials. A 401 UNAUTHENTICATED error usually means your user credentials have expired, and Google's page says to re-run the login command.
  • Treating GA4 as the source of truth for spend. It isn't for anything outside Google Ads and the platforms you import, as the cost section above explains.

Where to start

Install Google's server on one laptop with write tools off, paste the standing instruction above, and use it for two weeks of Monday checks before you give it to the team. If you'd like help setting up GA4, your ad platforms and your CRM as one connected set of tools for your team, that's the kind of work Scalewell does.

Frequently asked questions

Is there an official Google Analytics MCP server?

Yes. Google maintains it on GitHub as google-analytics-mcp, and you install it from PyPI as analytics-mcp. Version 1.1.0 was the latest release on November 9, 2026. You run it yourself, on your laptop or on your own Cloud Run service, and Google's developer site describes it as "available for read requests only", which holds while the write flag stays off.

Can I use Gemini instead of Claude with the Google Analytics MCP server?

Yes. Google's README documents setup for Gemini CLI and Gemini Code Assist. You add the same pipx run analytics-mcp command and the same two environment variables, GOOGLE_APPLICATION_CREDENTIALS and GOOGLE_CLOUD_PROJECT, to the mcpServers list in ~/.gemini/settings.json, using the credentials file you created for Claude.

Can I connect ChatGPT to GA4?

Yes, but ChatGPT needs a remote MCP server reachable over public HTTPS, so Google's server running on a laptop won't work directly. You can host Google's server on Cloud Run, use OpenAI's Secure MCP Tunnel, or use a hosted connector. Which ChatGPT plans allow custom MCP servers depends on your account and workspace policy.

Does a GA4 MCP server work with Google Analytics 360?

Yes. The same tools call the same Data API, and 360 properties get larger quotas: 2,000,000 tokens a day and 400,000 an hour per property, against 200,000 and 40,000 for standard properties. Sampling limits are also higher on 360, so long date ranges hold up better.

Should I use the GA4 MCP or the BigQuery export for analysis?

Use the MCP for quick questions in standard report shapes, such as channel trends, landing pages and funnels. Use the GA4 BigQuery export for event-level work, joins with CRM data and anything that hits thresholds. Standard properties can export up to 1 million events a day to BigQuery.