Google Analytics MCP: ask Claude or ChatGPT about your GA4 data
Connect GA4 to Claude or ChatGPT through an MCP server and ask about visitors, pages and sources. What each question runs, and the limits of the data.
7 minute read By SocialHelper team
A Google Analytics MCP server lets an AI assistant such as Claude or ChatGPT run GA4 reports for you. Ask which landing pages brought the most visitors from organic search last week. The assistant turns that into a Google Analytics Data API report, runs it and answers with the numbers. Google publishes an open-source server you run on your own computer, and hosted servers connect with a Google sign-in.
What a Google Analytics MCP server does
It turns questions into reports. An MCP server is a service that gives an AI assistant tools it can call, through the open Model Context Protocol (modelcontextprotocol.io). The Google Analytics Data API is Google’s interface for GA4 report data. Google says what it returns “is consistent with the data shown in the Google Analytics user interface” (Google: Data API overview).
A Google Analytics MCP server wraps that API in a few tools. SocialHelper’s has four, and all four only read.
| Tool | What it returns |
|---|---|
list_properties | The Analytics accounts the Google login can see, with each GA4 property’s ID and name |
run_report | Metrics over a date range, broken down by up to 9 dimensions, filtered and sorted |
run_realtime_report | Activity in the last 30 minutes, such as active users by country |
get_metadata | Every dimension and metric the property can report on, including custom ones |
A GA4 property is a grouping of data from a website or app in Google Analytics. Every report runs against one. Metrics are the numbers, such as sessions. Dimensions are what you group them by, such as pagePath or country. The full parameter list is on the Google Analytics tools page.
Two ways to connect it
You can run Google’s server or sign in to a hosted one. Google’s server, google-analytics-mcp, runs on your computer and is marked experimental. Its README asks you to install pipx and turn on two Google APIs in a Google Cloud project. You then set up Application Default Credentials with the read-only Analytics scope, and point Gemini or Claude Code at your credentials file (google-analytics-mcp on GitHub). It also has a funnel report and a list of linked Google Ads accounts, which SocialHelper’s tools don’t.
A hosted server skips the Cloud project and the credentials file. That’s how SocialHelper works.
- Connect Google Analytics. In the SocialHelper dashboard, open Accounts and choose Google Analytics. Sign in with the Google account that can see your property. One connection covers every property that login can see.
- Connect your assistant. Add SocialHelper to Claude as a custom connector, or to ChatGPT as a custom MCP server. The Claude setup page and the ChatGPT setup page have the steps. For Claude Desktop and Claude Code, see the guide to adding an MCP server to Claude.
- Check it works. Ask: “Which Google Analytics properties can you see?” The assistant runs
list_propertiesand names them.
Running Google’s server keeps your credentials on your own machine, with no third party in between. A hosted server is quicker to set up and works the same in Claude and ChatGPT. It also puts Search Console and your social accounts behind the same connection.
What a question turns into
The assistant answers by writing a report request, so the answer is only as good as that request. Take “which landing pages brought the most visitors from organic search last week?”. Through SocialHelper, run_report gets this input.
{
"property": "properties/123456789",
"start_date": "7daysAgo",
"end_date": "yesterday",
"metrics": ["sessions", "engagementRate"],
"dimensions": ["landingPage"],
"dimension_filter": {"filter": {"fieldName": "sessionDefaultChannelGroup",
"stringFilter": {"value": "Organic Search"}}},
"order_by": [{"metric": {"metricName": "sessions"}, "desc": true}],
"limit": 10
}
The date range covers the seven days before today. Google defines landingPage as “the page path associated with the first pageview in a session” (Google: API schema). The filter keeps only sessions from the Organic Search channel. The rows come back sorted by sessions, ten at most, each with its page, sessions and engagement rate.
Here are more questions, with the report behind each.
| Ask | The assistant runs |
|---|---|
| “How many people visited last week?” | activeUsers and sessions, no dimension, one total row |
| “Where did they come from?” | sessions by sessionDefaultChannelGroup |
| “What were our top 10 pages this month?” | screenPageViews by pagePath, sorted, limit 10 |
| “Do mobile visitors engage less?” | engagementRate by deviceCategory |
| “Which key events happened most?” | keyEvents by eventName |
| “How many people are on the site right now?” | run_realtime_report with activeUsers |
Name the property when you have more than one. Ask the assistant to show the dates and numbers it used, so a wrong date range is easy to spot.
Use the property ID, not the measurement ID
The Data API needs “a numeric Google Analytics property identifier”. You find it under Admin, then Property Settings (Google: property ID). The ID on your tracking code is a different one. That measurement ID starts with “G-” and identifies a web data stream (Google Analytics Help: measurement ID). SocialHelper rejects a “G-” value and points to the property ID. Ask the assistant to list your properties first, and it uses the right IDs.
What the data can and can’t tell you
- The last day or two can change. Google Analytics Help says “Data processing can take 24-48 hours”, and reports may change meanwhile. A standard property’s daily data typically takes about 12 hours (Google Analytics Help: data freshness). End a date range on yesterday at the latest.
- Dates follow the property’s time zone. “Yesterday” and “7daysAgo” are worked out “based on the property's reporting time zone”, not yours (Google: DateRange).
- Engagement rate is a fraction. In Google’s schema, 0.7239 means 72.39 percent of sessions were engaged, so ask the assistant to show it as a percentage.
- Some rows are withheld. Reports on age, gender, interests or audiences can be thresholded. Google does it to stop anyone “inferring the identity or sensitive information of individual users” (Google Analytics Help: data thresholds). A longer date range makes it less likely.
- Realtime is short and narrow. It covers the last 30 minutes, or 60 for Analytics 360. It also supports only “a limited subset of dimensions and metrics” (Google: realtime reports).
- Reports use a quota. A standard property gets 200,000 tokens a day and 40,000 an hour. Google says “most requests will charge 10 or fewer tokens”, though reports by page path can cost more (Google: limits and quotas). SocialHelper returns the remaining quota with every report.
- Row limits are generous. One request returns up to 250,000 rows. SocialHelper asks for 100 unless the assistant wants more, and the assistant can page through the rest.
From a report to a post
The same connection can publish, so a report can lead straight to a post. You could ask this.
Find our blog post with the most organic sessions this month. Write a LinkedIn post that points people to it, and show me before posting.
The assistant runs the report and reads the page. Then it drafts the post, checks it against LinkedIn’s limits and waits for your go-ahead. The Search Console guide does the same with search queries. You can also ask for both at once: “which pages got the most clicks from Google, and how long did those visitors stay?”
Frequently asked questions
Does Google Analytics have an MCP server?
Yes. Google publishes an open-source, experimental server, google-analytics-mcp, that runs on your computer with your own Google Cloud credentials. Google says it’s “available for read requests only” (Google: Try the Google Analytics MCP server). Hosted servers such as SocialHelper’s connect with a Google sign-in instead.
How do I connect Google Analytics to Claude?
Through an MCP server. You can install Google’s server and add it to Claude Code or Claude Desktop with your credentials file. Or connect Google Analytics in a hosted service such as SocialHelper, and add that service to Claude as a custom connector.
How do I access the Google Analytics API?
Call the Data API with your numeric property ID and an OAuth token with the Analytics read-only scope. The request has to come from a Google Cloud project with the API turned on. An MCP server handles those steps and lets an assistant write the report requests.
Can the assistant change my Google Analytics settings?
No. Google’s server and SocialHelper’s both use read-only access. They can run reports and list properties, but they can’t change your configuration or settings.
Why don’t the assistant’s numbers match the Google Analytics screen?
Usually because of a different date range, a time zone mix-up, or data that was still processing. The API returns the same data as the screen. Ask the assistant to show its exact dates, metrics and filters, then compare like with like.
Does this work in ChatGPT too?
Yes. It’s the same MCP server, so ChatGPT can run the same reports once SocialHelper is added as a custom MCP server in developer mode.
How we checked this
The tools and their inputs are read from SocialHelper’s Google Analytics integration, which we analyzed on October 17, 2026. We ran a fact check of the data limits that day against Google’s Data API documentation and Google Analytics Help. The self-hosted setup comes from the google-analytics-mcp README.
Spotted something that has changed? Contact us and we’ll correct it.