How to connect Claude to Google Analytics

Three ways to do it, who each one is for, and five prompts to start with.

How to connect Claude to Google Analytics

Claude cannot see your Google Analytics

I asked Claude where the visitors on my site come from. It gave me a lovely list of places visitors usually come from. Then I connected my Google Analytics and asked again, and a few seconds later it told me that most of my sessions were direct, Reddit was second, and ChatGPT was already on the list. Same question. One answer is a guess, the other is my site.

Claude needs your real data to give real answers. This guide shows three ways to give it your GA4 data (Google Analytics 4, the current version of Google Analytics). One is a file upload that takes two minutes. The other two use MCP (Model Context Protocol), the standard way to plug a tool into an AI assistant. A program that speaks MCP is called a server, and in Claude it shows up as a connector.

Pick your row in the table and skip to that step. Every prompt in this guide is one I ran on my own site.

Which way is right for you

WayCostSetup timeWhat Claude can doPick it if
Export a report and upload itFree2 minutesRead the one file you uploadedYou have one question today
Adchestra (hosted)10 requests free, then $2.95 a month3 minutesRun any GA4 report live, plus Google Ads, Tag Manager and Search Console. Changes only after you approve themYou want it working now and you are not a developer
Google's official server (self-hosted)FreeAbout an hourRun any GA4 report live. Writing is limited to annotations, custom dimensions and key events, and is off by defaultYou are fine with a terminal and Google Cloud, and want Google's own software

My honest advice: start with the export. If you catch yourself exporting a new file every week, connect properly.

Step 01

Way 1: Export a GA4 report and upload it to Claude

No connection, no Google Cloud, no payment. You download a CSV file from Google Analytics and give it to Claude. This works on every Claude plan.

From a standard report

  1. Open analytics.google.com and check the property name at the top left. If you have several, click it and pick the right one.
  2. Click Reports (the bar chart icon) in the left menu.
  3. Open the report you want. For pages, the default menu has it under Engagement, then Pages and screens. On some properties the menu is grouped by goal instead, and the same report sits under Business objectives, View user engagement and retention, Pages and screens.
  4. Set the date range at the top right.
  5. Click the Share this report icon (three dots joined by lines) above the chart.
  6. Click Download file, then Download CSV.
Share this report, then Download file, then Download CSV.
Share this report, then Download file, then Download CSV.

A standard report gives you one breakdown at a time. If you want traffic sources next to pages, use an exploration.

From an exploration

An exploration is GA4's build-your-own table. It is the better export when you want two things side by side, like landing page and source.

  1. Click Explore in the left menu, then Free-form.
  2. Drag the dimensions you want into Rows and the metrics into Values.
  3. Click the Export data icon (a down arrow) at the top right of the table and choose CSV.

The table on screen showed me 10 rows. The CSV had all of them. So do not worry about the Show rows setting before you export.

Both files start with a few lines beginning with # that name the property and dates. Leave them in. Claude reads them and knows your date range.

Ask Claude about the file

In Claude, click the plus button in the message box, choose Upload or add files, pick the CSV and send a question. This is the one I used:

Ask about the file
This is my Google Analytics 4 Pages and screens report for the last 28 days. Use only the numbers in the file and do not look anything up elsewhere.
1. Which pages get the most views, and how does engagement time per user compare between them?
2. Which page looks like people leave it quickly?
3. What should I look at next?
If something is missing from the file, say so. Do not guess.

Claude ranked my pages and compared engagement time. Then it said the useful thing: the pages report has no bounce rate or exit rate, so it could not tell where people really leave, and it asked for the landing page report and traffic sources. It was right. That is the limit of this way. Every follow-up question means another trip to GA4 and another file.

Step 02

Way 2: Connect with Adchestra

Adchestra is the hosted connector I built with my co-founder. It runs on Adchestra's servers, so you install nothing and you need no Google Cloud project. You paste one address into Claude and sign in with Google.

It works in Claude on the web, Claude Desktop and Cowork. Custom connectors are available on every Claude plan, and the free plan is limited to one custom connector.

  1. In Claude, click Plugins in the left menu. On older menus, open Customize, then Connectors.
  2. Click Add at the top right, then Add custom connector.
  3. In Name, type Adchestra.
  4. In MCP server URL, paste the address below. Click Continue.
  5. Keep Sign in now and Use Claude’s published identity selected, then click Add.
  6. Google sign-in opens. If it does not, click Connect on the Adchestra connector. Choose the Google account that can open your Google Analytics property, read the permissions and continue.
Adchestra address
https://mcp.adchestra.com/mcp
Two fields: a name and the address.
Two fields: a name and the address.

On a Team or Enterprise plan, an owner adds the connector for the organization first. After that each person connects their own Google account.

Claude sees exactly the GA4 properties your Google account can see. If a property is missing, the fix is in Google Analytics, not in Claude: ask an admin of that property to add your email under Admin, Property access management, with at least the Viewer role.

Adchestra reads and changes Google Analytics and Google Ads, and reads Tag Manager and Search Console. Every change is shown to you as a preview first and is applied only after you approve it. You get 10 free requests with no card, then a 14-day trial, then $2.95 a month.

Step 03

Way 3: Use Google's official Google Analytics MCP server

Google publishes its own Google Analytics MCP server on GitHub. It is free and open source. You run it on your own computer, and it talks to Google with your own credentials.

What it can and cannot do

I installed it on my Mac and listed its tools. Out of the box it has ten, all for reading: account and property details, Google Ads links, annotations, key events, custom dimensions and metrics, and four report types (standard, realtime, funnel and conversions). Start it with --allow-write and three more appear: create an annotation, create a custom dimension and mark an event as a key event. That is the full list. It cannot change data streams, filters, audiences or user access.

The bigger limit is where it runs. A server on your computer works with Claude Desktop and Claude Code. It does not work in Claude on the web or on your phone. The README also explains how to host it as a web service with its own sign-in, but that means running a server on Google Cloud. If you want that, you are building your own hosted connector.

What you need

  • Python 3.10 or newer and a runner: pipx or uv. A Mac ships with Python 3.9, which is too old. I used uv, which downloads the right Python by itself.
  • A Google Cloud project with two APIs switched on: the Google Analytics Admin API and the Google Analytics Data API. It is free.
  • A sign-in client (Google calls it an OAuth client) of the type Desktop app in that project, downloaded as a JSON file.
  • The gcloud command line, Google's terminal tool, to sign in once. Google's install page has the download for Mac and Windows.

The steps

  1. In the Google Cloud console, create or pick a project. Open APIs and services, then Library, and enable the Google Analytics Admin API and the Google Analytics Data API. Both. Forgetting one of them is a common cause of an error that says the service is disabled.
  2. Create the sign-in client. Google's Manage OAuth clients page shows the clicks. Download the JSON file.
  3. Sign in from your terminal with the command below. Note the credentials path it prints after Credentials saved to file:.
  4. Add the server to Claude. For Claude Code, use the second command. For Claude Desktop, open Settings, then Developer, then Edit Config, add the third block, save, and fully quit and reopen Claude.
Sign in to Google
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
Claude Code
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
Claude Desktop config
{
  "mcpServers": {
    "analytics-mcp": {
      "command": "pipx",
      "args": ["run", "analytics-mcp"],
      "env": {
        "GOOGLE_APPLICATION_CREDENTIALS": "PATH_TO_CREDENTIALS_JSON",
        "GOOGLE_CLOUD_PROJECT": "YOUR_PROJECT_ID"
      }
    }
  }
}

If you use uv instead of pipx, set "command" to the full path that which uvx prints and "args" to ["--python", "3.12", "analytics-mcp"]. Claude Desktop does not read your terminal's settings, so a bare uvx or pipx often fails with spawn pipx ENOENT. The full path fixes it.

Want the write tools? Add analytics.edit to the scopes in the sign-in command, run it again, and add "--allow-write" to the args.

When it fails

Without credentials, every question ends in an error that says Your default credentials were not found. That one is honest. The others are less obvious:

ErrorWhat it meansFix
Your default credentials were not foundThe sign-in step did not run, or Claude cannot find the fileRun the gcloud sign-in again and put the full path in GOOGLE_APPLICATION_CREDENTIALS. Do not use ~
SERVICE_DISABLED or has not been used in projectOne of the two Analytics APIs is off in your Google Cloud projectEnable both the Admin API and the Data API in the same project
User does not have sufficient permissions for this propertyThe Google account you signed in with cannot open that GA4 propertyGive that account the Viewer role on the property, or sign in with the right account
Request had insufficient authentication scopesYou signed in without the Analytics scopeRun the sign-in command again with both scopes
Failed to resolve analyticsadmin.googleapis.com on a MacA DNS problem in the networking library, often with a VPNAdd "GRPC_DNS_RESOLVER": "native" to env, as the troubleshooting guide says

Google's own setup page lists more cases, including the quota project error.

Step 04

Check that it works, then ask real questions

Start a new chat. The first question should be one Claude cannot answer from memory:

List properties
Which Google Analytics accounts and properties can you see? List them in a table. Read only. Do not change anything.

If you get your real property names back, you are connected. If you get advice about how GA4 accounts are structured, you are not.

If Claude says it has no access

This one catches people. The connector is added and signed in, and Claude still says it cannot use it. A connector can be switched off for a single chat. Claude then shows a small panel named Your connectors with a switch next to it. Turn the switch on and ask again. You can also click the plus button in the message box, open Plugins (or Connectors) and switch it on there.

The per-chat switch, under the plus button.
The per-chat switch, under the plus button.

Four questions worth asking

Each of these I ran through the connector on my own site. Replace example.com with your property name.

Where traffic comes from
In the property example.com, show sessions and engaged sessions by session source / medium for the last 28 days, as a table sorted by sessions. Then tell me in two sentences where most of my traffic comes from. Read only.

Claude also added that direct traffic often includes untagged links, so the real split may differ. That is the kind of caveat I want.

Landing pages, compared
Now landing pages. For example.com, show the top landing pages for the last 28 days with sessions, engagement rate and average engagement time per session. Compare with the 28 days before that and point out the biggest change. Read only.

This is where a connection beats an export. Claude ran two periods, did the division GA4 does not show you, and flagged which changes were too small to mean anything.

Traffic from AI assistants
Which AI assistants send visitors to example.com? Look for chatgpt, claude, perplexity, gemini and copilot in session source over the last 90 days. Show sessions, engaged sessions and the landing page for each. Read only.

It also found a source I had not asked about, openai, and told me it was probably the same thing. GA4 has no ready-made report for this, so this prompt alone is worth the setup.

Who is on the site now
How many people are on example.com right now, and which pages, countries and devices are they on? Use the realtime report. Read only.

Realtime covers only the last 30 minutes. On a small site the honest answer is often "nobody", and Claude says so instead of inventing someone.

Keep changes on "Allow once"

Claude asks before it runs a tool. For reports, Always allow is fine. For anything that changes your property, like a key event or a custom dimension, keep it on Allow once and read the preview. GA4 changes are not dangerous the way a budget change is, but a wrong key event quietly spoils every report after it.

Using Claude Cowork?

Cowork is the part of Claude that takes a longer job, works through it in steps and hands you a finished file, such as a document or a spreadsheet. A connector you added once works there too. You do not add it again.

On my account there is no Cowork button any more. I describe the longer task in a normal chat and Claude runs it as a task, with a progress panel on the right. Anthropic says accounts with the older layout have a Cowork button below the message box.

Before you start, check that the connector is on for that task: click the plus button in the message box, open Plugins (or Connectors) and look at the switch. One limit: a server that runs on your own computer, such as Google's official Analytics server, works only in a Cowork session that runs on your computer, not in one that runs in the cloud.

For jobs that suit Cowork, with the prompts I ran on a real account, see How to use Claude Cowork for Google Ads.

Frequently asked questions

Does Google have an official Google Analytics MCP server?

Yes. Google publishes one for free on GitHub, called analytics-mcp. It runs reports and reads property settings, and with a flag it can create annotations, custom dimensions and key events. You run it on your own computer with your own Google Cloud project, so it works in Claude Desktop and Claude Code, not in Claude on the web.

Is there a Google Analytics MCP URL I can paste into Claude?

Google does not run a public one. Its server runs on your computer, or on a server you host yourself. To paste an address into Claude, you need a hosted connector such as Adchestra.

Why can Claude not see one of my GA4 properties?

Claude sees what the Google account you signed in with can see. Check in Google Analytics, under Admin and Property access management, that this account has at least the Viewer role on that property. If you have several Google accounts, make sure you signed in with the right one.

Does this work on the free Claude plan?

Yes. Uploading an export works on every plan. Custom connectors also work on the free plan, limited to one connector. A server that runs on your own computer needs the Claude Desktop app or Claude Code.

Can I connect ChatGPT or Gemini the same way?

The export works with any assistant that reads files. Google's official server works with any app that runs local MCP servers, and its README starts with Gemini CLI. A hosted connector works wherever you can add an MCP address.

Does this work in Claude Cowork?

Yes. A connector you add in Claude is also available in Cowork, so your Google Analytics connection needs no second setup. Check that its switch is on for the task. A server on your own computer only works in a Cowork session that runs on that computer.