Skip to content

How to connect Google Analytics to Claude (and a faster way to ask about your traffic)

Three ways to ask Claude about your website analytics: Google's official GA4 MCP server, a hosted GA4 connector, or Lantern's one-click connector in Claude's directory. Setup steps, what each can answer, and where GA4's blind spots follow you into the chat.

· 14 min read

You can connect Google Analytics to Claude with an MCP server, a small program that lets Claude call an analytics API while it answers you. Google publishes an official one for GA4. It's free, it's read-only, and it runs on your own computer once you've set up a Google Cloud project and credentials. Hosted connectors from companies like Supermetrics and Windsor.ai skip the setup and charge for it.

There's also a shorter path if what you really want is to ask Claude where your customers come from. Lantern is web analytics for founders, and it's listed in Claude's connectors directory: click Connect, sign in, and ask. No Google Cloud project, no API keys, and it works on claude.ai, the desktop app and your phone.

This guide covers all three routes: how to set up each one, what you can ask, and the part most tutorials skip. Claude can only answer from the data it's given, so whatever GA4 can't see, Claude can't see either.

What "connecting analytics to Claude" actually means

Claude doesn't log in to your Google Analytics and look around. It connects through the Model Context Protocol (MCP), an open standard for giving AI assistants tools. An MCP server for analytics exposes a handful of tools, such as "run a report" or "list my sites", and Claude decides when to call them while it answers your question.

So when you ask "why did traffic drop on Tuesday?", this is what happens:

  1. Claude reads your question and picks a tool, for example a report of sessions by day and by source.
  2. The MCP server runs that query against your analytics and returns the numbers.
  3. Claude reads the numbers, maybe calls another tool to drill in, and explains what it found.

Two things follow from that. First, the answers are only as good as the tools: a server that can run any report gives Claude flexibility, a server with well-shaped tools gives it fewer ways to get things wrong. Second, the answers are only as good as the data underneath. Claude will happily explain your "Direct" traffic in detail, without knowing that half of it came from ChatGPT.

Which channels brought paying customers this month? And where do people from ChatGPT land?

  • lantern · get_revenue by channel, last 30 days
  • lantern · get_breakdown entry pages where channel = AI

Google search is still first: $1,519 from 31 customers. ChatGPT is right behind with $1,258 from 22, and its customers pay more on average, $57 against $49.

61% of ChatGPT visitors land on /pricing, most of the rest on /docs/install. They arrive ready to compare, so that's the page to keep sharp.

Example data, in Claude Code.

Three ways to ask Claude about your website traffic

Google's GA4 MCP serverHosted GA4 connectorLantern in Claude
SetupGoogle Cloud project, two APIs, credentials, a config fileSign up with the vendor, connect GA4, add a URLClick Connect in Claude's directory, sign in
Where it worksClaude Desktop and Claude Code on your computerClaude on web, desktop and mobileClaude on web, desktop and mobile, plus Claude Code, Cursor, Codex
CostFreePaid plans from the vendorIncluded in every Lantern plan, from $8 a month
DataYour GA4 propertyYour GA4 propertyLantern's own tracking: AI channel, crawlers, revenue
AI trafficMixed into Referral, as in GA4Mixed into Referral, as in GA4Its own channel: ChatGPT, Claude, Perplexity, Gemini
Revenue by channelOnly if you send purchases to GA4 yourselfOnly if you send purchases to GA4 yourselfFrom Stripe, Paddle, Polar, Lemon Squeezy, Razorpay and more
Changes your data?Read-only by defaultDepends on the vendorRead-only, always

Option 1: Google's official Google Analytics MCP server

Google maintains an open-source MCP server for GA4 at github.com/googleanalytics/google-analytics-mcp. It talks to the Google Analytics Admin API and Data API, and gives Claude tools to list your accounts and properties, read a property's custom dimensions, and run standard and realtime reports. That's about as flexible as GA4 itself: anything you can build in Explore, Claude can ask for.

What you need

  • A GA4 property with data in it, and a Google account that can read it.
  • A Google Cloud project with the Google Analytics Admin API and Google Analytics Data API enabled.
  • The gcloud CLI, to create Application Default Credentials with the Analytics read-only scope.
  • Python with pipx, which runs the server.
  • Claude Desktop or Claude Code, because the server runs as a local process on your machine.

Setting it up

  1. In the Google Cloud console, create or pick a project and enable the two Analytics APIs.
  2. Sign in for Application Default Credentials with gcloud auth application-default login, requesting the analytics.readonly scope. Note the path of the credentials file it writes.
  3. Add the server to Claude Desktop's config file (Settings → Developer → Edit Config), then restart Claude:
claude_desktop_config.json
{
  "mcpServers": {
    "analytics-mcp": {
      "command": "pipx",
      "args": ["run", "analytics-mcp"],
      "env": {
        "GOOGLE_APPLICATION_CREDENTIALS": "/path/to/application_default_credentials.json",
        "GOOGLE_PROJECT_ID": "your-cloud-project-id"
      }
    }
  }
}

The exact command and scopes change between releases, so follow the repository's README for the current version. Once it's running, ask Claude to list your GA4 properties to check the connection, then ask for a report.

Where it shines, and where it gets awkward

  • Good: it's free, official and flexible. If your team lives in GA4 and someone is comfortable with Google Cloud, it's a sensible choice.
  • Awkward: it runs on one computer. It isn't available in Claude on the web or on your phone, and every person on your team has to repeat the setup.
  • Awkward: GA4's data model is big. Claude has to choose among hundreds of dimensions and metrics for each question, and GA4 applies thresholds and sampling to some reports, so you'll sometimes get an answer to a slightly different question than the one you asked.

Option 2: a hosted GA4 connector

Marketing-data companies such as Supermetrics, Windsor.ai and Adzviser run GA4 MCP servers for you. You connect your Google account on their site, then add their connector in Claude (some are in Claude's directory, others give you a URL to paste as a custom connector). It works on the web and on mobile, and it usually bundles other sources too, like Google Ads and Meta Ads.

The trade-offs are a subscription priced for agencies and marketing teams, and a third company that can read your analytics. Check what they store and whether their tools can write as well as read.

The part nobody mentions: GA4's blind spots come with it

Whichever GA4 route you pick, Claude is reading GA4's numbers. For many founders, the questions they most want to ask are exactly the ones GA4 answers worst:

"How much traffic do we get from ChatGPT?"

GA4 files chatgpt.com, perplexity.ai and claude.ai under Referral, next to every blog that ever linked to you, and visits from ChatGPT's apps often arrive with no referrer at all and land in Direct. Claude can sum the referrers it recognises, but it can't recover the ones GA4 never recorded. (More in how to track ChatGPT traffic.)

"Which AI crawlers read our pricing page?"

GPTBot, ClaudeBot and PerplexityBot never run JavaScript, so GA4 never sees them. No MCP server can report what was never collected. (See why GPTBot doesn't show up in GA4.)

"Which channel brought paying customers?"

GA4 knows revenue only if you send purchase events with values, and it doesn't see renewals, refunds or the Stripe customer behind a sign-up. Claude can't connect a Reddit thread to a subscription that GA4 never heard about.

"Why is so much of our traffic Direct?"

Ad blockers stop GA4 for a fifth to a third of technical audiences, and untagged links from apps, Slack and email land in Direct. Claude will describe that Direct traffic faithfully. It just can't tell you where it came from. (See what direct traffic really is.)

Option 3: Lantern's connector in Claude's directory

Lantern is analytics built around one question: which channels bring customers. Its MCP server was built for assistants from the start, and it's listed in Claude's connectors directory, so connecting it takes a minute.

Connect it in Claude (web, desktop or mobile)

  1. Open Lantern in Claude's connectors directory and click Connect.
  2. Sign in to Lantern and click Allow. You're sent back to Claude, connected.
  3. Ask a question. Claude finds your sites by itself.

That's it. No key to copy, and it carries over to Claude's mobile apps. You can disconnect at any time from the AI assistants page in your Lantern dashboard, which cuts off access immediately.

Connect it in Claude Code, Cursor or Codex

In Claude Code, add the server and run /mcp to sign in:

Terminal
claude mcp add --transport http --scope user lantern https://visitlantern.com/api/mcp

Other MCP clients connect to https://visitlantern.com/api/mcp over Streamable HTTP. Clients that support MCP's OAuth sign-in find it by themselves; others use an API key from your dashboard. The docs have the setup for each assistant.

What Claude can do with it

Lantern gives Claude ten read-only tools, each shaped around a question founders actually ask:

ToolWhat it answers
get_overviewVisitors, pageviews, sessions, bounce rate and time on site for a range, against the previous period
get_timeseriesThe same numbers by hour or day, for spotting the dip or the spike
get_breakdownChannels, referrers, UTM campaigns, pages, countries, cities, devices and goals, with filters
get_revenueRevenue, refunds and customers by channel, referrer or campaign, from your payment provider
run_funnel / get_funnelsConversion and drop-off between any pages and goals, saved or not
get_ai_crawlersWhich AI crawlers read your site, by company and by page
get_realtimeWho's on the site right now and what they're reading
get_event_propertiesThe details sent with a goal, like the plan someone bought
list_sitesEvery site in your account

Because filters combine with breakdowns, Claude can drill in the way you would: the pages that ChatGPT visitors land on, revenue from one campaign in one country, the funnel for mobile visitors only. It reads the same numbers as your dashboard and can't change anything.

Questions worth asking your analytics

Once any of these is connected, these prompts are a good start. The last few are where Lantern's data makes the difference.

  • "How did traffic this week compare with last week, and what drove the change?"
  • "Which landing pages have the highest bounce rate on mobile?"
  • "Where do visitors drop off between the pricing page and signing up?"
  • "Which UTM campaigns from last month brought sign-ups, not just clicks?"
  • "How many visitors came from ChatGPT, Perplexity and Claude this month, and which pages did they land on?"
  • "Which channels brought paying customers, and which customers pay the most on average?"
  • "Which AI crawlers read our docs this week? Did any of them read the pricing page?"
  • "Is anyone on the site right now? Where did they come from?"

A tip that works with any analytics connector: name the date range and ask for a comparison. "Last 30 days against the 30 before" gets a sharper answer than "recently", and asking "what changed?" makes Claude look for causes instead of reading numbers back to you.

Which should you choose?

  • You're committed to GA4 and comfortable in Google Cloud: use Google's official MCP server in Claude Desktop. It's free and flexible.
  • You run marketing across many ad platforms and clients: a hosted connector that bundles GA4 with your ad accounts is worth paying for.
  • You're a founder who wants to know where customers come from, including from ChatGPT and other assistants, and which channels pay: use Lantern. It's one click in Claude, it works on your phone, and the data underneath answers the questions GA4 can't.

They aren't mutually exclusive. Lantern's 1.8 KB script runs alongside GA4, so you can keep GA4 for ads and use Lantern for attribution, AI traffic and asking Claude. If you're thinking of switching entirely, our GA4 alternative guide covers it.

Questions people ask

Can Claude access Google Analytics directly?

Not on its own. Claude needs an MCP server or connector that calls the GA4 API for it: Google's official server on your computer, or a hosted connector. Once one is connected, Claude can run GA4 reports when you ask.

Is there an official Google Analytics MCP server?

Yes. Google publishes one on GitHub as googleanalytics/google-analytics-mcp. It runs locally, uses the Admin and Data APIs, and is read-only by default.

Does the GA4 MCP server work on claude.ai or the Claude mobile app?

Not directly, because it runs as a local process. Claude on the web and on mobile uses remote connectors, which is what hosted GA4 connectors and Lantern provide.

Is it safe to connect analytics to Claude?

Look for read-only access and a way to revoke it. Lantern's connector can only read, you approve it once on a consent screen, and you can disconnect it from your dashboard at any time. Lantern stores no visitor IP addresses, and the connector never receives your conversations, only the question's parameters, such as a site and a date range.

Does it work with ChatGPT too?

Any assistant that supports remote MCP servers can connect to Lantern at https://visitlantern.com/api/mcp. Claude, Claude Code, Cursor, Codex and VS Code all do today.

How much does Lantern cost?

Plans start at $8 a month, with a 7-day free trial and no card needed. The Claude connector, AI traffic tracking and revenue attribution are on every plan. You can explore the live demo first.

Keep reading