Guide

How to connect Google Analytics 4 to ChatGPT, Claude and other AI assistants

Ask ChatGPT or Claude about users, channels, landing pages, key events and revenue, and get answers from your own GA4 reports instead of a pasted export.

How the connection works

AI assistants reach outside data through MCP, the Model Context Protocol. An MCP server offers a small set of tools, and the assistant calls them when your question needs them. ChatGPT, Claude, Codex, Cursor and VS Code all support remote MCP servers.

QuerySail runs a hosted Google Analytics 4 MCP server. You approve read-only Analytics access on Google's consent screen once, add one URL to your AI app and sign in. There is no Google Cloud project, service account or API key, and nothing to install.

What you can ask

Ask in plain language. Your assistant picks the tool, dates, dimensions, metrics and filters, and the answer states the date range, time zone and filters it used.

QuestionToolWhat comes back
Which Google Analytics properties can you access?list_propertiesEach GA4 property's ID, such as properties/123456789, its display name and its Analytics account.
How many users and sessions did the site have in the last 28 days?run_reportActive users, sessions and views for the 28 days ending yesterday, in the property's time zone.
Which channels brought the most sessions and key events last month?run_reportSessions and key events by default channel group, highest first.
Which landing pages from Organic Search have the best engagement rate?run_reportLanding pages filtered to the Organic Search channel, with engagement rate as a fraction.
Which sources gained or lost the most sessions compared with the previous 28 days?compare_reportBoth periods' totals with absolute and percent changes, and the top gaining and losing source and medium pairs.
Compare organic search sessions with the same weeks last year.compare_reportA comparison against 52 weeks earlier, so Mondays line up with Mondays.
Which custom dimensions and key events does this property have?list_fieldsThe API names of the property's custom dimensions, custom metrics and key events, ready for a report.
What was revenue by country in September?run_reportTotal revenue per country in the property's currency. If your Google account cannot see revenue, Google withholds it.
How many people are on the site right now, and on which pages?run_realtime_reportActive users in the last 30 minutes, by page or screen.

Example: which channels changed

With no dates, compare_report compares the last 28 days ending yesterday with the 28 days before, in one Google request. With a breakdown such as channel, it returns the top gainers and losers.

Example answer, with made-up numbers. For Example Store (properties/123456789), 2026-09-08 to 2026-10-05 in the property's time zone, Europe/London, against the previous 28 days, sessions rose from 11,900 to 12,480, up 4.9%. Organic Search gained the most, up 610 sessions. Paid Search lost the most, down 240. Google applied data thresholds to this report, so some small rows are missing.

The data shows what changed, not why. When your assistant suggests a cause, treat it as a lead to check.

Example: who is on the site now

run_realtime_report covers the last 30 minutes and skips the cache, so each call reads fresh data.

Example answer, made up. In the last 30 minutes, Example Store had 37 active users: 14 in the United States, 9 in the United Kingdom and 6 in Germany. The page with the most active users was "Pricing". Realtime figures are preliminary.

Set up QuerySail

Setup takes about five minutes.

  1. Create a QuerySail account. The trial needs no card.
  2. Open Account → Connections, select Connect Google Analytics and approve read-only Analytics access. Every GA4 property that Google account can read becomes available. You can connect more than one Google account.
  3. Add the endpoint below to your AI app and sign in with your QuerySail account when it asks.
  4. Ask "Which Google Analytics properties can you access?" to check the connection.
https://mcp.querysail.com/ga4/mcp
  1. Open Settings → Security and login and turn on Developer mode. Availability depends on your plan and workspace settings.
  2. Go to chatgpt.com/plugins and select the plus button.
  3. Name it QuerySail Analytics, paste the endpoint above as the connection URL and create it.
  4. Sign in with your QuerySail account when asked, then add QuerySail from the tools menu in a new chat.

Limits and accuracy

GA4 data has limits that are easy to miss when an assistant summarizes it. QuerySail adds notes about them to its answers, and your assistant should pass them on.

Other ways to get GA4 data into an AI assistant

QuerySail is one option. Depending on how often you ask and which app you use, one of these may suit you better.

Export a CSV and upload it

Export a report from Google Analytics and attach the file to a chat. It is free and works in any assistant that accepts files. The file holds only the dimensions and date range of that one report, and every new question about another breakdown or period needs a new export.

Use Google's own tools

The GA4 reports and explorations, the Looker Studio connector and the BigQuery export all read your Analytics data. Looker Studio suits dashboards you check regularly. The BigQuery export gives you event-level data, but it needs a Google Cloud project and SQL. None of them lets you ask questions in ChatGPT or Claude.

Run an open-source MCP server yourself

Google publishes an experimental, open-source Google Analytics MCP server, and others exist on GitHub. The software is free. Google's server runs on your machine with Python, and you set up a Google Cloud project, enable the Analytics Admin and Data APIs and sign in with your own credentials. It also has tools QuerySail does not offer, such as funnel reports and Google Ads links. A local server works with Claude Desktop, Claude Code, Cursor and VS Code. ChatGPT and claude.ai only connect to servers on the internet, so for them you also host the server and secure it. If you are comfortable with that, self-hosting is a good choice.

When QuerySail fits

QuerySail suits you if you want the same GA4 data in ChatGPT, claude.ai and your editor without running anything, or if you look after several properties or Google accounts. It costs $8 per month after the 7-day trial, and the same plan covers Search Console. See the Google Analytics MCP server page for every tool and option.

Questions, answered

Something else? See support.

Can ChatGPT connect to Google Analytics 4?

Yes, through an MCP server such as QuerySail. In ChatGPT you turn on developer mode, add QuerySail with its Google Analytics endpoint URL and sign in with your QuerySail account. ChatGPT can then run GA4 reports when you ask a question.

How do I connect GA4 to Claude?

In Claude Desktop or on claude.ai, add QuerySail Analytics as a custom connector under Customize → Connectors. In Claude Code, run claude mcp add with the QuerySail Google Analytics endpoint, then sign in through /mcp. The setup tabs on this page have the exact steps.

Do I need a paid ChatGPT or Claude plan?

It depends on the app. In ChatGPT, developer mode availability depends on your plan and workspace settings. Claude's free plan allows one custom connector. Your AI app's plan is separate from QuerySail.

Will the numbers match the Google Analytics interface?

They come from the Google Analytics Data API, which reads the same data as the GA4 reports. Differences usually come from the date range or time zone, from the last 48 hours still being processed, or from thresholding and sampling. Each answer says when Google thresholded or sampled the report.

Does it work with custom dimensions and key events?

Yes. The list_fields tool finds your property's custom dimensions, custom metrics and key events, and run_report can group, filter and sort by them.

Does it work with Universal Analytics?

No. QuerySail reads Google Analytics 4 properties only.

Where does my Analytics data go?

QuerySail fetches reports from Google when your assistant asks, keeps them in a 15-minute cache and returns them to the AI app you connected. Realtime reports are not cached. From there the app's own privacy terms apply.

How much does it cost?

Google Analytics is included in the same $8 per month plan as Search Console, with unlimited connected properties. The 7-day free trial needs no card and starts with your first successful report in either product.