Google Analytics

Merge lets you securely connect your agents to Google Analytics and thousands of tools instantly

Available tools

View all tools by creating a free accountSee more tools

How to set up
Merge Agent Handler

In an mcp.json file, add the configuration below, and restart Cursor.

Learn more in the official documentation ↗

1{
2  "mcpServers": {
3    "agent-handler": {
4      "url": "https://ah-api.merge.dev/api/v1/tool-packs/{TOOL_PACK_ID}/registered-users/{REGISTERED_USER_ID}/mcp",
5      "headers": {
6        "Authorization": "Bearer yMt*****"
7      }
8    }
9  }
10}
Copy Code

Open your Claude Desktop configuration file and add the server configuration below. You'll also need to restart the application for the changes to take effect.

Make sure Claude is using the Node v20+.

Learn more in the official documentation ↗

1{
2  "mcpServers": {
3    "agent-handler": {
4      "command": "npx",
5      "args": [
6        "-y",
7        "mcp-remote@latest",
8        "https://ah-api.merge.dev/api/v1/tool-packs/{TOOL_PACK_ID}/registered-users/{REGISTERED_USER_ID}/mcp",
9        "--header",
10        "Authorization: Bearer ${AUTH_TOKEN}"
11      ],
12      "env": {
13        "AUTH_TOKEN": "yMt*****"
14      }
15    }
16  }
17}
Copy Code
Copied!

Open your Windsurf MCP configuration file and add the server configuration below.
Click on the refresh button in the top right of the Manage MCP server page or in the top right of the chat box in the box icon.

Learn more in the official documentation ↗

1{
2    "mcpServers": {
3      "agent-handler": {
4        "command": "npx",
5        "args": [
6          "-y",
7          "mcp-remote@latest",
8          "https://ah-api.merge.dev/api/v1/tool-packs/<tool-pack-id>/registered-users/<registered-user-id>/mcp",
9          "--header",
10          "Authorization: Bearer ${AUTH_TOKEN}"
11        ],
12        "env": {
13          "AUTH_TOKEN": "<ah-production-access-key>"
14        }
15      }
16    }
17  }
Copy Code

In Command Palette (Cmd+Shift+P on macOS, Ctrl+Shift+P on Windows), run "MCP: Open User Configuration".

You can then add the configuration below and press "start" right under servers. Enter the auth token when prompted.

Learn more in the official documentation ↗

1{
2  "inputs": [
3    {
4      "type": "promptString",
5      "id": "agent-handler-auth",
6      "description": "Agent Handler AUTH_TOKEN", // "yMt*****" when prompt
7      "password": true
8    }
9  ],
10  "servers": {
11    "agent-handler": {
12      "type": "stdio",
13      "command": "npx",
14      "args": [
15        "-y",
16        "mcp-remote@latest",
17        "https://ah-api.merge.dev/api/v1/tool-packs/{TOOL_PACK_ID}/registered-users/{REGISTERED_USER_ID}/mcp",
18        "--header",
19        "Authorization: Bearer ${input:agent-handler-auth}"
20      ]
21    }
22  }
23}
Copy Code

FAQ on integrating with Google Analytics’s API

Heading

What is a Google Analytics MCP?

It's an MCP server that lets your agents access data and functionality from Google Analytics via tools. Your agents can invoke these tools to run custom reports, pull real-time traffic data, list audiences, check conversion events, and more.

Google Analytics offers an official MCP server, but you can also use one from a third-party platform, like Merge Agent Handler.

How can I use the Google Analytics MCP server?

The use cases naturally depend on the agent you've built, but here are a few common ones:

  • Traffic anomaly detection: an agent monitors real-time and daily traffic reports and flags sudden spikes or drops against baseline, then posts an alert to Slack so the team can investigate before a launch or outage goes unnoticed
  • Marketing performance reporting: an agent pulls channel-level traffic and conversion data on a schedule and compiles a weekly summary for stakeholders, without anyone opening the GA4 interface
  • Conversion funnel analysis: an agent runs a funnel report across a signup or checkout flow, identifies the step with the highest drop-off, and surfaces it in a ticket for the product team to investigate
  • Cross-tool spend correlation: an agent combines Google Analytics conversion data with ad spend from a connected ad platform or pipeline data from a CRM to calculate blended cost per acquisition by campaign

What are popular tools for Google Analytics's MCP server?

Here are some of the most commonly used tools:

  • run_report: runs a custom Google Analytics report across dimensions and metrics you specify, like sessions by channel or revenue by landing page. Useful for agents that need to answer a specific analytics question on demand
  • run_realtime_report: pulls active user and event data from the last 30 to 60 minutes. Call this when an agent needs to detect a traffic spike or confirm a launch is tracking correctly
  • list_audiences: returns the audiences configured on a property, along with their membership rules. Good for workflows that need to check segmentation before targeting or reporting on a specific group
  • create_key_event: marks an existing event as a key event (conversion) so it shows up in conversion reporting. Helpful when an agent needs to register a new conversion goal without going into the GA4 admin panel
  • create_custom_dimension: defines a new custom dimension on a property so it can be used in future reports. Use this when an agent needs to track a new attribute, like subscription tier or content author, that GA4 doesn't capture by default
  • list_properties: lists the Google Analytics properties available to the authenticated account. Useful for agents that manage reporting across multiple sites or apps and need to confirm which property to query first

What makes Merge Agent Handler's Google Analytics MCP server better than alternative Google Analytics MCP servers?

There are several reasons to use Merge Agent Handler's Google Analytics MCP server over building or using an alternative:

  • Enterprise-grade security and DLP: Merge Agent Handler includes built-in data loss prevention controls that let you block or redact sensitive fields before they reach an agent. For Google Analytics, this means you can prevent user-level traffic data or audience segments from being exposed even when the agent has broad read access
  • Managed authentication and credentials: Merge stores and refreshes Google Analytics credentials on your behalf. You never expose raw API keys or OAuth tokens to an agent or manage token rotation manually
  • Real-time observability and audit trail: every tool call made against Google Analytics is logged with timestamp, tool name, input parameters, and response metadata. You can audit exactly what an agent read or wrote without instrumenting anything yourself
  • Tool Packs and controlled access: Tool Packs let you bundle specific Google Analytics tools with tools from other connectors into a single MCP endpoint, scoped to a specific use case. An agent gets exactly the tools it needs, nothing more

How can I start using Merge Agent Handler's Google Analytics MCP server?

You can take the following steps:

1. Create or log into your Merge Agent Handler account.

2. Install the Merge CLI by running pipx install merge-api, then run merge configure to link the CLI to your Merge account and merge login to authenticate your session.

3. Register the Agent Handler MCP server with Claude Code by running claude mcp add --transport http agent-handler https://ah-api.merge.dev/mcp, then open Claude Code and run /mcp to confirm agent-handler appears with a connected status.

4. Select agent-handler from the MCP list. This opens a browser window where you select which integrations to authenticate. Choose Google Analytics and complete the auth flow. Merge stores and manages the credentials going forward.

5. Open a Claude Code session and start querying Google Analytics data directly. The first time you use a Google Analytics tool, a Magic Link may appear to complete connector authentication.

If you want to connect Merge Agent Handler's Google Analytics MCP with internal or customer-facing agentic products, you can follow the steps in our docs.

Can employees use Merge to connect their AI tools to Google Analytics?

Yes, Merge for Workforce lets your employees connect Claude, ChatGPT, Microsoft Copilot, Cursor, and other MCP-compatible AI tools to Google Analytics without bypassing IT governance.

IT provisions access by role or group via SCIM. A marketing analyst, for example, gets Google Analytics access to pull weekly traffic reports, HubSpot to review campaign performance, and Slack to share findings with the team; while a growth engineer gets Google Analytics access to monitor conversion events, Google Ads to adjust bidding strategy, and Jira to track experiment tickets.

Every tool call an employee's AI makes to Google Analytics is also inspected against your DLP rules and logged to a searchable audit trail, giving security teams full visibility into what data was accessed and by whom.

Explore other MCP servers built and managed by Merge

View Docs
Guru
Guru
Harmonic
Harmonic
Heroku
Heroku
Hex
Hex
HeyGen
HeyGen
HiBob
HiBob
Hive Intelligence
Hive Intelligence
Honeycomb
Honeycomb
HubSpot
HubSpot
Hugging Face
Hugging Face
incident.io
incident.io
InstantDB
InstantDB
Intercom
Intercom
Ironclad
Ironclad
Iterable
Iterable
Jam
Jam
Jamf Pro
Jamf Pro
Jenkins
Jenkins
Jira
Jira
Jira Data Center & Server
Jira Data Center & Server
Jira Service Management
Jira Service Management
Jotform
Jotform
JumpCloud
JumpCloud
Kintone
Kintone

Ready to try it out?

Whether you're an engineer experimenting with agents or a product manager looking to add tools, you can get started for free now