erica-ga4-mcp
v1.2.1
Published
MCP server for Google Analytics 4 - access GA4 data from Claude
Maintainers
Readme
ERICA GA4 MCP Server
Google Analytics 4 MCP Server for ERICA - provides GA4 data access via the Model Context Protocol.
Features
- ga4_list_accounts: List all GA4 accounts and properties
- ga4_get_property_details: Get details about a specific property
- ga4_run_report: Run custom reports with any dimensions/metrics
- ga4_run_realtime_report: Get real-time analytics data
- ga4_get_top_pages: Get top performing pages
- ga4_get_traffic_sources: Get traffic source breakdown
- ga4_get_user_metrics: Get user metrics (new vs returning, devices)
- ga4_get_conversions: Get conversion/event data
- ga4_get_dimensions: List available dimensions
- ga4_get_metrics: List available metrics
- ga4_compare_periods: Compare metrics between time periods
Setup for Team Members
Option A: Connect to ERICA Server (Recommended)
This is the easiest setup for team members. The ERICA server handles OAuth authentication centrally.
Prerequisites:
- GA4 must be authorized in the ERICA web UI (one-time setup by admin)
Claude Desktop Config (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"ga4": {
"command": "npx",
"args": ["-y", "erica-ga4-mcp"],
"env": {
"ERICA_SERVER_URL": "https://erica.s1.solicom.net"
}
}
}
}That's it! The MCP will fetch tokens from the ERICA server automatically.
Option B: Service Account (for standalone use)
If you need to use GA4 MCP without the ERICA server:
- Create a service account in Google Cloud Console
- Enable GA4 Admin API and GA4 Data API
- Grant the service account Viewer access to your GA4 properties
- Configure Claude Desktop:
{
"mcpServers": {
"ga4": {
"command": "npx",
"args": ["-y", "erica-ga4-mcp"],
"env": {
"GA4_SERVICE_ACCOUNT_KEY": "{\"type\":\"service_account\",...}"
}
}
}
}Admin Setup (One-Time)
For the ERICA server option to work, an admin needs to:
Enable APIs in Google Cloud Console:
Add OAuth redirect URI to the Google Cloud OAuth client:
- Go to APIs & Services → Credentials
- Edit the OAuth 2.0 Client ID
- Add redirect URI:
https://erica.s1.solicom.net/oauth/ga4/callback
Authorize GA4 in ERICA:
- Visit the ERICA web UI
- Click "Authorize GA4" in the purple banner
- Sign in with a Google account that has access to your GA4 properties
Example Questions
Once connected, you can ask questions like:
- "What were my top 5 traffic sources last month?"
- "How did mobile vs desktop traffic perform this quarter?"
- "Which pages have the highest bounce rate?"
- "Show me conversion rates broken down by country"
- "What's my real-time user count right now?"
- "How many new users did I get from organic search last week?"
- "Compare my traffic this month vs last month"
Common Dimensions
date,dateHour,dateHourMinutecountry,city,regiondeviceCategory,operatingSystem,browserpagePath,pageTitle,landingPagesessionSource,sessionMedium,sessionDefaultChannelGroupeventNamenewVsReturning
Common Metrics
activeUsers,newUsers,totalUserssessions,sessionsPerUserscreenPageViews,screenPageViewsPerSessionaverageSessionDuration,bounceRateengagedSessions,engagementRateeventCount,conversions
