Connecting Claude to Google Analytics & BigQuery
Set up MCPs for GA4 and BigQuery so Claude can query your analytics data directly.
The End of the CSV Export
If you've ever exported a CSV from Google Analytics, cleaned it up in Sheets, and then pasted it into Claude just to ask a question about your traffic — this lesson is your liberation. We're going to connect Claude directly to GA4 and BigQuery so it can query your data in real time. No exports. No formatting. Just answers.
Prerequisites
- Claude Desktop installed and running on your machine
- A Google Cloud project with GA4 and BigQuery APIs enabled
- A service account with read-only access (we'll create this together)
Step 1: Install the GA4 MCP
Open your Claude Desktop configuration file and add the GA4 and BigQuery MCP servers. On macOS, this file lives at ~/Library/Application Support/Claude/claude_desktop_config.json. Add the following to your mcpServers object:
{
"mcpServers": {
"google-analytics": {
"command": "npx",
"args": ["-y", "@anthropic/mcp-ga4"],
"env": {
"GA4_PROPERTY_ID": "properties/YOUR_PROPERTY_ID",
"GOOGLE_APPLICATION_CREDENTIALS": "/path/to/service-account.json"
}
},
"bigquery": {
"command": "npx",
"args": ["-y", "@anthropic/mcp-bigquery"],
"env": {
"BQ_PROJECT_ID": "your-gcp-project-id",
"GOOGLE_APPLICATION_CREDENTIALS": "/path/to/service-account.json"
}
}
}
}Step 2: Create a Read-Only Service Account
In Google Cloud Console, create a new service account with these roles:
- Analytics Viewer (roles/analytics.viewer) — read-only access to GA4 reports
- BigQuery Data Viewer (roles/bigquery.dataViewer) — read-only access to BigQuery tables
- BigQuery Job User (roles/bigquery.jobUser) — permission to run queries
Restart and Verify
Quit Claude Desktop completely and reopen it. You should see the MCP tools icon (a small hammer) in the bottom-left of the chat input. Click it to verify that both google-analytics and bigquery servers are connected. If you see green checkmarks, you're ready to query.
Querying GA4
Claude queries the GA4 Data API directly, returning a formatted table with your real-time analytics data.
Using GA4, show me the top 10 landing pages by sessions this month. Include bounce rate and average session duration for each.
Querying BigQuery
Claude writes and executes a BigQuery SQL query, then presents the pathing analysis in a readable format.
Query BigQuery for the most common user journey paths — show me the top 5 sequences of page views that lead to a purchase event, with conversion rates for each path.
Connect Claude to your GA4 property and run your first live query.
Install the GA4 MCP using the configuration above, then ask Claude: 'What were our top 5 traffic sources last week, and how did each perform on conversion rate?'
Get weekly job alerts
Curated marketing analytics roles — delivered every Monday.