Which pages bring visitors who actually become leads? You can ask Claude to investigate that directly in your GA4 data.
The useful part is the follow-up. If organic leads fell, ask which landing pages changed, whether the drop came from fewer sessions or a lower key event rate, and whether mobile behaved differently. You can move through those questions in one conversation instead of building another report for every breakdown.
Here I’ll walk through Google’s open-source Analytics MCP server, the local setup for Claude Desktop, and the prompts I would use for a marketing performance review. This connects to GA4 reporting data; it does not install tracking on your website.
The different ways to connect Google Analytics to AI
| Method | Setup | Best fit |
|---|---|---|
| Google’s official Analytics MCP | Local Python server using Google Cloud credentials | Claude Desktop or another client that can launch a local MCP process |
| A hosted GA4 MCP service | Remote URL and the provider’s authentication flow | A browser assistant with compatible remote MCP support; check the provider’s GA4 tools and permissions |
| A report or CSV upload | Export from GA4 and attach the file | A one-off analysis of a fixed snapshot; new questions may require another export |
For Claude Desktop, I would start with the official server if you are comfortable with a short terminal setup. For ChatGPT in the browser, you need a compatible remote service: pasting a local Claude configuration into ChatGPT will not start the Python server on your computer.
Connect GA4 locally to Claude Desktop
1. Check your GA4 access before creating credentials
Open the GA4 property you want to analyze and note its numeric property ID. A measurement ID starting with G- is a different identifier. Use a Google account that can already view the reports, or ask the property administrator to grant access.
You will also need a Google Cloud project, the Google Cloud CLI, Python 3.10 or later, and pipx for the configuration below. The official Google Analytics MCP guide lists the prerequisites. Access to a Cloud project and access to a GA4 property are separate permissions.
2. Enable both Analytics APIs
In Google Cloud Console, select your project and open APIs & Services → Library. Enable Google Analytics Admin API and Google Analytics Data API. The server uses the former to discover accounts and properties and the latter to query reports.
3. Sign in with read-only Analytics credentials
Run this in your terminal, then sign in with the Google account that has GA4 access:
gcloud auth application-default login --scopes="https://www.googleapis.com/auth/analytics.readonly,https://www.googleapis.com/auth/cloud-platform"
The command creates Application Default Credentials and prints where they were saved. Keep that absolute file path. Set the quota project to the Cloud project where you enabled the APIs:
gcloud auth application-default set-quota-project YOUR_PROJECT_ID
Do not paste the credential file into a chat. The local server needs its path, not a public copy of the credentials. If you use a service account instead, that account also needs access to the GA4 property.
4. Add the server to Claude’s desktop configuration
Open Claude Desktop’s developer settings and edit its MCP configuration. The usual file is %APPDATA%\Claude\claude_desktop_config.json on Windows or ~/Library/Application Support/Claude/claude_desktop_config.json on macOS. Add this server inside your existing mcpServers object:
{
"mcpServers": {
"analytics-mcp": {
"command": "pipx",
"args": [
"run",
"analytics-mcp"
],
"env": {
"GOOGLE_APPLICATION_CREDENTIALS": "ABSOLUTE_PATH_TO_YOUR_CREDENTIALS_JSON",
"GOOGLE_CLOUD_PROJECT": "YOUR_PROJECT_ID"
}
}
}
}
Replace both placeholders. On Windows, JSON paths need escaped backslashes, such as C:\\Users\\YourName\\credentials.json. Preserve other servers already in the file. Fully quit and reopen Claude after saving.
This launch configuration follows the official google-analytics-mcp repository. If pipx works in your terminal but Claude cannot find it, use its full executable path in the command field.
5. Confirm the property and run a small report
Use the Analytics MCP to list the accounts and properties I can access. Show each property’s name and numeric ID. Do not select one automatically if several properties match my website.
Once you have the right ID:
For GA4 property [ID], show sessions and active users for the last seven complete days. Include the exact dates, property time zone and metric names used. Return the totals before adding any interpretation.
Compare that small result with GA4 using the same dates. A successful property list proves authentication works; a successful report proves you can query the selected property.
What to do when the connection fails
| Problem | What to check |
|---|---|
| No properties appear | Confirm the authenticated Google account can open the property in GA4. A Cloud project role alone is insufficient. |
| 403 or insufficient permissions | Check both APIs are enabled in the quota project, GA4 property access, and the OAuth scopes. Reauthorize if you originally used different scopes. |
| The server never starts | Check Python and pipx installation, the executable path, valid JSON and the absolute credential path. Restart Claude fully. |
| The report uses the wrong website | Give the numeric property ID explicitly. Agencies often have similar property names across accounts. |
| Results differ from the GA4 interface | Match dates, time zone, filters, metric definitions and report scope before treating the difference as a data problem. |
Read-only access and the limits of the data
Google’s server is designed for reading Analytics information, not changing your tracking settings. That makes it useful for investigation. It still sends the retrieved reporting data to your AI assistant, so use the appropriate client workspace for each customer.
A more common analytical mistake is mixing scopes. First-user acquisition answers how a user was originally acquired; session acquisition answers where a particular visit came from. A page path and a landing page also answer different questions. Google documents the fields in its Data API dimensions and metrics reference.
Before accepting a recommendation, ask the assistant to show the report behind it. Ten visits and two leads do not establish that a page converts better than one with thousands of visits. A missing event cannot be repaired by a better prompt, and a traffic report alone cannot prove why someone did not convert.
The best prompts for Google Analytics MCP
Find landing pages worth improving
For property [ID], compare the last 28 complete days with the previous 28. Group by landing page and session default channel group. Use sessions and the session key event rate for [lead event], if that metric is available. Keep pages with at least 200 sessions. Separate traffic losses from conversion-rate losses, show absolute changes, and rank five pages to investigate. Explain what cannot be concluded from this report alone.
This gives you a shortlist for a page review. A drop in sessions suggests an acquisition question; a stable audience with fewer leads suggests a different investigation.
Check whether paid traffic is producing leads
For [property] and [dates], compare session source/medium and campaign for paid traffic. Show sessions, the available lead-event metrics and revenue where it is tracked. Flag missing or inconsistent campaign names. Do not calculate ROAS unless reliable campaign spend is available; list the extra data needed.
GA4 sessions are not ad clicks, and lead events are not automatically qualified opportunities. Connect CRM or ad-spend data separately when those are the question.
Investigate a mobile conversion drop
Compare mobile and desktop for [landing-page group] across [two date ranges]. Start with sessions and the key event rate for [event], then break the largest change down by browser and source/medium. Show denominators and exclude tiny segments from the ranking. Give three testable explanations with the evidence needed to confirm each.
Turn the analysis into a client update
Summarize [property] for [calendar month] versus the preceding month. Show acquisition, landing-page and lead-event changes in three short tables. For each of the three most consequential changes, include the supporting numbers, one proposed investigation and its owner. Label tracking gaps separately from business performance.
For SEO, combine the landing-page findings with the other marketing MCP tutorials. GA4 tells you what visitors did after arriving; Search Console answers a different question about search visibility and clicks.

Conversation