How do you connect Claude to GA4?

Quick Answer: You can connect Claude to GA4 by setting up a Google Analytics MCP (Model Context Protocol) server. This gives Claude direct, live access to your GA4 property data so you can query traffic, conversions, and user behaviour in plain English. The setup takes around 20-30 minutes and requires a Google Cloud service account.
B2B SaaS teams spend hours pulling GA4 reports that answer the wrong questions. Connecting Claude to GA4 flips that. Instead of exporting CSVs from dashboards, you ask Claude what you actually want to know and get a direct answer from live data.
This tutorial covers the full setup: Google Cloud authentication, MCP server configuration, connecting it to Claude, and the weekly insight prompts that make this genuinely useful for SaaS growth work.
What Is an MCP Server and Why Does It Matter for GA4?
MCP (Model Context Protocol) is an open standard that lets AI models like Claude connect to external data sources in real time. Instead of pasting data into a chat window, Claude queries the source directly through a structured server connection.
For GA4 specifically, an MCP server acts as a bridge between Claude and the Google Analytics Data API. Claude sends a query, the MCP server authenticates with Google, retrieves the data, and returns it to Claude in a format it can reason over.
Why this matters for B2B SaaS: Your GA4 data contains signals about trial signups, feature adoption funnels, and acquisition channel performance. Querying that data conversationally, without needing to pre-build every report, changes how fast you can act on it. This becomes even more valuable when paired with strong B2B SaaS marketing operations, because better reporting infrastructure makes experimentation and decision-making much faster.
What You Need Before You Start
Before touching any configuration, make sure you have:
- Claude Desktop installed (available at claude.ai/download)
- A GA4 property with data already flowing
- A Google account with admin access to that GA4 property
- Node.js installed on your machine (version 18 or higher)
- Basic comfort with terminal commands (you will run a few commands, nothing complex)
If you are using Claude via API rather than Claude Desktop, the MCP configuration steps differ slightly. This tutorial covers the Claude Desktop setup.
Step 1: Create a Google Cloud Project
Google Cloud is where you generate the credentials that let Claude authenticate with the Analytics Data API.
- Go to console.cloud.google.com
- Click Select a project at the top of the screen, then click New Project
- Name the project something recognisable, for example "Claude GA4 MCP"
- Click Create and wait for the project to initialise
- Make sure your new project is selected in the top navigation bar
This project acts as a container for your API credentials. You are not deploying anything here, just creating an authentication layer.
Step 2: Enable the Google Analytics Data API
With your project created, you need to switch on the specific API Claude will use.
- In the Google Cloud Console, go to APIs and Services > Library
- Search for "Google Analytics Data API"
- Click the result and then click Enable
- Wait for the API to activate (usually under 30 seconds)
Do not confuse this with the older Universal Analytics API or the Google Analytics Reporting API. The Analytics Data API is the GA4-specific version and is the one the MCP server requires.
Step 3: Create a Service Account
A service account is a non-human Google account that your MCP server uses to authenticate API requests. This is the right approach for server-to-server access.
- In the Google Cloud Console, go to APIs and Services > Credentials
- Click Create Credentials and select Service Account
- Give it a name like "claude-ga4-mcp" and click Create and Continue
- For the role, select Viewer (read-only access is all Claude needs)
- Click Done
Once the service account is created:
- Click on the service account name in the credentials list
- Go to the Keys tab
- Click Add Key > Create New Key
- Select JSON and click Create
- A JSON file will download to your machine. Store it somewhere you will remember, for example
~/keys/claude-ga4.json
Keep this file secure. Anyone with access to it can read your GA4 data.
Step 4: Grant the Service Account Access to Your GA4 Property
The service account exists in Google Cloud, but GA4 does not know about it yet. You need to add it as a user inside your GA4 property.
- Go to analytics.google.com
- Select your GA4 property
- Click the Admin cog in the bottom left
- Under the Property column, click Property Access Management
- Click the + button and select Add Users
- Paste in the service account email address (it looks like
claude-ga4-mcp@your-project-id.iam.gserviceaccount.com) - Set the role to Viewer
- Click Add
The service account can now read data from this GA4 property. If you manage multiple properties, repeat this step for each one you want Claude to access.
Step 5: Note Your GA4 Property ID
Claude will need your GA4 Property ID to know which property to query.
- In GA4, go to Admin > Property Settings
- Your Property ID is a numeric string, for example
123456789 - Copy and save it
This is different from your Measurement ID (which starts with "G-"). Make sure you are copying the numeric Property ID.
Step 6: Install and Configure the GA4 MCP Server
Several open-source GA4 MCP servers exist. A well-maintained option is the @thadius856/ga4-mcp-server package, though you can also use community packages like insightfulpipe-ga4-mcp. The configuration pattern is the same across them.
Open your terminal and run:
npm install -g @modelcontextprotocol/server-google-analytics
If you prefer to use a specific community server, check its GitHub repository for the exact package name and any additional setup steps.
Step 7: Configure Claude Desktop to Use the MCP Server
This is where you wire everything together. Claude Desktop reads MCP server configurations from a JSON config file.
Find your Claude Desktop config file:
- Mac:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
Open the file in any text editor. If it does not exist yet, create it.
Add the following configuration inside the mcpServers object:
{
"mcpServers": {
"google-analytics": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-google-analytics"
],
"env": {
"GOOGLE_APPLICATION_CREDENTIALS": "/absolute/path/to/your/claude-ga4.json",
"GA4_PROPERTY_ID": "123456789"
}
}
}
}
Replace /absolute/path/to/your/claude-ga4.json with the actual path to your downloaded credentials file. Replace 123456789 with your real GA4 Property ID.
Save the file and restart Claude Desktop completely (quit and reopen, not just close the window).
Step 8: Verify the Connection
After restarting Claude Desktop, look for the MCP connection indicator. In the Claude Desktop interface, you should see a small tools icon or connection status showing your GA4 server is active.
To test it, start a new conversation and type:
"How many sessions did my website get in the last 7 days?"
If the connection is working, Claude will query your GA4 property and return a direct answer with the actual number. If it returns an error, the most common causes are:
- Wrong file path in the config (must be absolute, not relative)
- Service account not added to the GA4 property
- Wrong Property ID (numeric, not the G- Measurement ID)
- Node.js version below 18
Weekly Insight Prompts for B2B SaaS Teams
Once the connection is live, the real value comes from the questions you ask consistently. These prompts are designed for B2B SaaS teams tracking trial signups, activation, and acquisition.
Acquisition and Traffic
- "Show me sessions by channel for the last 30 days and highlight any channels where traffic dropped more than 15% week over week."
- "Which landing pages are driving the most trial signup conversions this month?"
- "Compare organic search traffic this month versus the same period last month."
If organic search is an important growth lever for your team, it can also help to benchmark what specialist B2B SaaS SEO agencies focus on when turning analytics insights into pipeline growth.
Trial and Conversion Funnel
- "How many users completed the trial signup event in the last 7 days, and what was the conversion rate from landing page view to signup?"
- "Which traffic sources have the highest trial signup conversion rate?"
- "Show me the drop-off at each step of my onboarding funnel over the last 14 days."
User Behaviour
- "What are the top 10 pages by engagement rate this week?"
- "Which features (tracked as events) had the highest usage among new users in the last 30 days?"
- "Show me average session duration by device category for the last 28 days."
Weekly Review Prompt (Use Every Monday)
"Give me a weekly summary of last week's performance. Include: total sessions, new users, top acquisition channels, trial signup conversion rate, and any metric that moved more than 20% compared to the previous week. Flag anything that needs attention."
This single prompt, run every Monday morning, replaces a manual reporting process that typically takes 45-60 minutes. For teams building a broader reporting engine around attribution, conversion tracking, and campaign analysis, specialist B2B SaaS marketing ops agencies can help connect the analytics layer to the rest of the revenue stack.
Troubleshooting Common Issues
Claude says it cannot find the MCP server Check that you restarted Claude Desktop fully after editing the config file. Partial restarts do not reload the MCP configuration.
Authentication errors from Google
Verify the path to your JSON credentials file is absolute (starts with / on Mac/Linux or C:\ on Windows). Relative paths do not work in this config.
"Property not found" errors Confirm you are using the numeric Property ID from GA4 Admin settings, not the Measurement ID that starts with "G-".
No data returned for date ranges Check that your service account has been added to the correct GA4 property and that the property has data for the requested date range.
FAQs
What is the GA4 MCP server for Claude? The GA4 MCP server is a local server that connects Claude to the Google Analytics Data API using the Model Context Protocol. Once configured, Claude can query your GA4 property directly in conversation, pulling live data on sessions, events, conversions, and user behaviour without requiring manual data exports.
Is it safe to connect Claude to Google Analytics? Yes, when set up correctly. The service account uses read-only Viewer access, so Claude can retrieve data but cannot modify your GA4 property or Google Cloud project. Your credentials JSON file should be stored securely and not committed to any public repository.
Do I need to pay for anything to connect Claude to GA4? The Google Analytics Data API has a generous free tier that covers standard reporting queries. For most B2B SaaS teams running weekly analysis, you will not hit the paid tier. Claude Desktop requires a Claude subscription (Pro plan or above) to use MCP servers. There are no additional charges from Google for standard API usage at typical query volumes.
Can I connect Claude to multiple GA4 properties?
Yes. Add each property as a separate entry in your claude_desktop_config.json file with its own Property ID. You will need to grant the same service account Viewer access to each additional GA4 property.
What is the difference between this approach and using Zapier to connect GA4 to Claude? Zapier-based integrations trigger automated workflows between GA4 and Claude based on events or schedules. The MCP approach gives Claude direct, on-demand query access to your raw GA4 data. For ad-hoc analysis and weekly insight generation, MCP is more flexible. For automated alerts or triggered workflows, Zapier-style integrations may suit better.
How is this different from just exporting GA4 data and pasting it into Claude? Manual exports are static snapshots. The MCP connection gives Claude access to live data with the ability to query any date range, dimension, or metric combination on demand. You also avoid the manual step entirely, which is where most teams lose consistency in their reporting habits. Teams producing supporting reporting content at scale may also want to review how specialist B2B SaaS content marketing agencies turn performance data into content strategy.
Find a B2B SaaS Expert
We've collected a directory of B2B SaaS experts and agencies that we've reviewed and categorised based on service and specialism for your review.


