GA4 Analytics MCP — Google Analytics 4 for AI Coding Agents

GA4 Analytics MCP is a VS Code extension that turns your AI coding agent into a GA4 MCP server for AI agents. In other words, instead of switching between your code editor and the Google Analytics dashboard, you ask your AI agent to pull the data directly. Claude, Copilot, Codex, Gemini, Cursor, and Cline can all query your Google Analytics 4 properties using natural language.

Additionally, the extension requires zero configuration for most setups. Install it from the VS Code Marketplace, authenticate with your Google account, and start asking questions. There are no config files to edit, no environment variables to set, and no command-line setup required.

Furthermore, GA4 Analytics MCP was built using the Model Context Protocol (MCP), the open standard that lets AI models use external tools through a unified interface. As a result, any AI agent that supports MCP can use this extension to access your analytics data.

Why Developers Need a GA4 MCP Server for AI Agents

Developers and marketing teams check Google Analytics constantly. Traffic reports, landing page performance, real-time user counts, campaign attribution — this data drives decisions about what to build, what to fix, and where to focus.

However, the traditional workflow is slow. Specifically, you open the GA4 dashboard, navigate to the right report, set your date range, add filters, and export the data. For developers who already spend their day inside VS Code, this context switching wastes time and breaks flow.

Moreover, the existing GA4 MCP servers on the market require 60+ minutes of setup. They need command-line configuration, service account JSON files, environment variables, and manual server registration. Most developers give up before they finish the setup.

GA4 Analytics MCP eliminates that friction. It works as a GA4 MCP server for AI agents with a one-click install from the VS Code Marketplace. In fact, the extension auto-registers with eight different AI agents automatically. As a result, your analytics data is available the moment you open VS Code.

What You Can Ask Your AI Agent

Once installed, you can query your GA4 data using natural language. Specifically, here are examples of what your AI agent can answer:

  • Traffic overview — “How many users visited my site in the last 30 days?”
  • Landing pages — “Show me the top 10 landing pages by sessions this month.”
  • Real-time data — “How many active users are on my site right now?”
  • Traffic sources — “Which channels are driving the most traffic this week?”
  • Engagement — “What is the average engagement time for my blog posts?”
  • Conversions — “How many purchases happened in the last 7 days?”
  • Geographic data — “Which countries are sending the most traffic?”
  • Device breakdown — “What percentage of visitors use mobile vs desktop?”

In addition, the extension supports all GA4 dimensions and metrics. Consequently, any report you can build in the GA4 dashboard, your AI agent can generate for you inside VS Code.

How GA4 Analytics MCP Works

The extension provides six MCP tools that your AI agent calls to interact with Google Analytics 4:

Tool What It Does
get_account_summaries List all GA4 accounts and properties you have access to
get_property_details Get details about a specific GA4 property including timezone and currency
run_report Run a full GA4 report with dimensions, metrics, filters, and date ranges
run_realtime_report Query real-time analytics data for active users and current activity
get_custom_dimensions_and_metrics Retrieve custom dimensions and metrics configured on your property
list_google_ads_links List Google Ads accounts linked to your GA4 property

Most importantly, you never call these tools directly. Your AI agent translates your natural language question into the right tool call, sends it to the GA4 MCP server, and formats the response for you. The entire process is transparent.

Three Authentication Methods

GA4 Analytics MCP supports three ways to authenticate with Google:

OAuth 2.0 (Recommended)

The simplest option. Specifically, the extension opens a browser window, you sign in with your Google account, and authentication is complete. No config files, no JSON keys, no environment variables. This is the recommended method for individual developers.

Application Default Credentials (ADC)

For developers who already use gcloud auth application-default login in their workflow. Similarly, the extension detects your existing credentials automatically.

Service Account Key

For automated environments and teams. In addition, you can provide a service account JSON key file for server-to-server authentication without interactive login.

Notably, the extension stores all credentials in VS Code’s encrypted SecretStorage, which uses your operating system’s keychain. No credentials are written to disk as plain text.

Auto-Registration with AI Agents

Unlike other GA4 MCP servers that require manual registration, GA4 Analytics MCP auto-registers with eight AI agents:

  1. VS Code Copilot — GitHub’s AI assistant in agent mode
  2. Claude Code — Anthropic’s agentic coding tool
  3. Cursor — the AI-first code editor
  4. Codex — OpenAI’s coding agent
  5. Gemini — Google’s coding agent
  6. Windsurf — Codeium’s AI development environment
  7. Continue.dev — the open-source AI assistant
  8. Cline — the autonomous coding agent

As a result, you install the extension once and every AI agent you use can access your GA4 data immediately. There is no per-agent configuration required.

Privacy and Security

GA4 Analytics MCP was built with privacy as a core requirement:

  • No telemetry — the extension does not collect any usage data or analytics.
  • Local processing — all API calls go directly from your machine to Google’s servers. No data passes through third-party servers.
  • Encrypted storage — credentials are stored in VS Code’s SecretStorage using your OS keychain (macOS Keychain, Windows Credential Manager, or Linux Secret Service).
  • Read-only access — the extension only reads GA4 data. It cannot modify your analytics configuration, create properties, or change any settings.

In short, your analytics data stays between your machine and Google. No intermediaries.

GA4 Analytics MCP vs Other GA4 MCP Servers

Feature GA4 Analytics MCP Other GA4 MCP Servers
Installation One-click from VS Code Marketplace CLI setup, 60+ minutes
Configuration Zero config, auto-registers Manual JSON config per agent
Authentication OAuth browser flow (3 clicks) Service account JSON required
Agent support 8 agents auto-registered 1-2 agents, manual setup
Telemetry None Varies
Price Free Free / Paid

Consequently, GA4 Analytics MCP is the fastest way to connect Google Analytics 4 to your AI coding agent. Install it, authenticate, and start querying.

Setting Up GA4 Analytics MCP

Step 1: Install the Extension

Search for “GA4 Analytics MCP” in the VS Code extensions panel or install it directly from the Marketplace.

Step 2: Authenticate with Google

Next, open the command palette in VS Code and run the GA4 authentication command. A browser window opens where you sign in with your Google account. After that, the extension stores your credentials securely and loads your available GA4 properties.

Step 3: Start Querying

Finally, open any AI agent chat in VS Code and ask a question about your analytics. For instance, “Show me my top landing pages by sessions for the last 7 days.” The agent calls the GA4 MCP server, retrieves the data, and formats the response.

Common Questions

Does the extension work with GA4 free accounts?

Yes. GA4 Analytics MCP works with any Google Analytics 4 property, including free accounts. In fact, most users run it against their free GA4 properties without any limitations.

Can I query multiple GA4 properties?

Yes. The extension lists all properties your Google account has access to. Specifically, your AI agent can switch between properties by referencing the property ID or name in your query.

What happens to my data?

All API calls go directly from your machine to Google’s servers using the official GA4 Data API. The extension does not store, cache, or transmit your analytics data to any third party.

Part of a Collection of VS Code Extensions

GA4 Analytics MCP is part of a collection of VS Code extensions built for AI-assisted development. Similarly, the other extensions in this collection solve specific problems that AI coding agents face daily:

  • Arc Terminal Bridge — gives AI agents full terminal control inside VS Code with complete output capture.
  • Iris for Claude — a Telegram bridge that lets you message Claude Code from anywhere.

Additionally, these extensions were built by the same developer behind the Contact Form 7 Mailchimp Extension and the other free WordPress plugins that have been downloaded nearly 10 million times since 2015.

Getting Started

GA4 Analytics MCP is a GA4 MCP server for AI agents that eliminates the gap between your code editor and your analytics dashboard. As a result, your AI assistant can answer traffic questions, generate reports, and surface insights without you ever leaving VS Code.

Furthermore, if you need help with setup or have questions, contact us directly. For more tools built for developers, visit Arc Terminal Bridge and Iris for Claude.