Back to Blog

Ask AI About Your Analytics: GA4 and Beyond

What it takes to query Google Analytics from an assistant, what limits you will meet, and how a hosted analytics MCP server changes the setup.

Published
Written by
Eliran Yihye

Tags

  • mcp
  • google analytics
  • ai

Many teams already have Google Analytics running and are asking a reasonable question: can I just talk to it? Ask an assistant what happened on the site last week, instead of opening a report builder and choosing dimensions.

You can, with some effort. This post covers what the setup involves for Google Analytics, where people get stuck, and how the experience differs when the analytics tool itself ships a hosted MCP server. We make one, so we'll describe the trade-offs rather than pretend there are none.

The shape of the problem

An AI assistant doesn't know your numbers. It needs a tool that fetches them, and MCP is the common way to give it one. For Google Analytics 4 that tool talks to Google's reporting interfaces. Google has published an MCP server for this purpose that you run yourself. It reads reports and account information. Third-party servers also exist, with their own coverage.

Whichever you pick, the pattern is the same:

  1. A Google Cloud project with the relevant analytics APIs enabled.
  2. Credentials for it, either a service account or user authorization.
  3. Access granted to the GA4 properties you want to query.
  4. A local process or hosted service that runs the MCP server.
  5. The assistant configured to launch or connect to it.

It's a short list on paper. In practice each step has its own pitfalls.

Where people get stuck

Credentials and access. A service account needs to be added to the GA4 property with a suitable role. People forget this step, and the error that follows is a generic permission failure. Using personal authorization avoids it but ties the setup to one person's login.

Property IDs. GA4 uses numeric property IDs, separate from the measurement ID in your tracking snippet. Assistants don't know them. You will end up pasting the ID into your prompts, or listing properties first.

Dimension and metric names. The GA4 reporting model has its own vocabulary: specific dimension and metric names, rules about which can combine, and quotas. An assistant that guesses names gets errors. Good servers expose a way to discover the valid ones, and the assistant needs to use it.

Sampling, thresholds and latency. GA4 can apply data thresholds and sampling in some reports, and recent data may not be complete. An assistant summarizing a number won't mention that unless the tool output tells it to.

Running it locally. If the server runs on your laptop, a teammate can't use it without repeating the setup. Moving it to a shared host adds credential management you now own.

None of this is a flaw in the idea. It's the cost of attaching a protocol to a system that wasn't designed for agents.

What a hosted analytics MCP server changes

When the analytics product provides the server, a lot of that setup disappears.

With OnyxMetric, the endpoint is https://app.onyxmetric.com/api/mcp. Your client connects over HTTPS. For clients that support the MCP authorization flow, such as Claude Code, Claude Desktop, Codex and opencode, you sign in through a browser and approve access. There's no cloud project to create and no service account to grant. For headless uses, a personal API key works instead.

The tools already know your data model. Instead of guessing GA4-style dimension names, the assistant uses tools like list_sites, get_overview, get_breakdown, get_retention and analyze_funnel, whose parameters are designed for the product. When a question doesn't fit any of them, run_query accepts a read-only query against your event data, and get_query_schema tells the assistant the table layout first.

Permissions follow the connected user. A scoped key can limit an agent to reads, or to one site.

An honest comparison

ConcernGA4 plus a Google MCP serverHosted server from your analytics tool
SetupCloud project, credentials, property access, a runtimeAdd a URL, approve in browser
Who can use itWhoever completes the setupAny user with access to the product
Query vocabularyGA4 dimensions and metricsProduct-specific tools
WritesMostly readingReads plus goals, funnels, and settings, gated by scope
Data you can ask aboutWhatever your GA4 property collectsWhatever the product collects

That last row is the real constraint. An MCP server doesn't create data. If your questions are about Google Ads attribution, Google's own integrations will give you things a different tool can't. If your questions are about funnels, retention, errors, Web Vitals and replay, you want the system that collected them.

Should you switch analytics to get this?

Not for the MCP server alone. It's a convenience layer. Switch, if you do, for the reasons that apply regardless: simpler reports, cookieless collection that reduces consent friction, faster pages, and data you can reach without a report builder. The assistant access is a bonus that comes with a modern product.

If you stay on GA4, the Google server is a reasonable way to start. Test it on a property with a limited audience first, verify what the assistant says against the GA4 interface, and keep an eye on sampling and thresholds.

Questions that work well with any assistant

Whatever the backend, these hold up:

  • "Compare sessions and conversions for the last 28 days with the previous 28."
  • "Which landing pages brought the most new visitors from organic search?"
  • "What changed on mobile after the release on the 12th?"
  • "List the top five events by count and tell me which ones are new."

Ask for the date range in the answer. Ask the assistant to name the tool it used and show the parameters. That makes it easy to spot a wrong assumption.

What to remember

An assistant is only as good as its tools and its access. Setting up Google Analytics for it is feasible and fiddly. A hosted server from the analytics product itself is quicker to start and matches the data model, at the cost of living inside that product. Choose based on where your data lives and who needs to ask the questions.

Ready for better analytics?

The full analytics surface on one dashboard: cookieless, private, and live in minutes.

Managed, monitored, and supported by us.