analytics
Google Analytics MCP, CLI, and Lua Integration for AI Agents
Google Analytics integration docs for AI agents: MCP gateway setup, Google Analytics CLI commands, Lua API reference, credentials, and function schemas.
4 functions 4 read 0 write OAuth browser flow auth
Google Analytics for agents
OAuth can be configured in web hosts through redirect and in CLI hosts through local/device authorization; runtime works with stored tokens.
Use this integration from Lua code mode, the headless integrations CLI, or the KosmoKrator MCP gateway. The same package metadata powers all three surfaces.
Machine-Readable Metadata
- integration_slug
google_analytics- route_slug
google-analytics- package
google- auth_strategy
oauth2_authorization_codeOAuth browser flow- cli_setup_supported
true- cli_runtime_supported
true- mcp_gateway_supported
true- lua_supported
true- supports_multi_account
false
Quick Links
Lua APIAgent-facing namespace and function reference. Google Analytics CLIHeadless setup and direct function calls. Google Analytics MCPMCP gateway setup for external clients. Submit feedbackReport missing tools, auth problems, wrong docs, or runtime issues. ContributeAdd tools or improve metadata in the integrations repo.
Google Analytics MCP Client Matrix
Use these pages when a specific agent client or framework needs copy-pasteable MCP setup for Google Analytics.
Claude Code Google Analytics MCP setup for Claude Code. Cursor Google Analytics MCP setup for Cursor. Codex Google Analytics MCP setup for Codex. OpenAI Agents Google Analytics MCP setup for OpenAI Agents SDK. Claude Agent SDK Google Analytics MCP setup for Claude Agent SDK. Vercel AI SDK Google Analytics MCP setup for Vercel AI SDK. LangChain Google Analytics MCP setup for LangChain. LangGraph Google Analytics MCP setup for LangGraph. CrewAI Google Analytics MCP setup for CrewAI. MCP clients Google Analytics MCP setup for Generic MCP Clients.
Google Analytics CLI Matrix
Use these pages for direct Google Analytics CLI workflows in scripts, CI, cron, and agent wrappers.
CI Google Analytics CLI for CI. Cron Jobs Google Analytics CLI for cron jobs. Shell Scripts Google Analytics CLI for shell scripts. Headless Automation Google Analytics CLI for headless automation. Coding Agents Google Analytics CLI for coding agents.
Function Catalog
| Function | Type | Parameters | Description |
|---|---|---|---|
google_analytics.google_analytics_list_properties | Read read | 0 | List all accessible GA4 properties with their IDs and names. Use this first to discover the propertyId needed for other Analytics tools. |
google_analytics.google_analytics_metadata | Read read | 1 | List all available dimensions and metrics for a GA4 property, including custom ones. Use this to discover what data can be queried in reports. |
google_analytics.google_analytics_realtime | Read read | 4 | Run a GA4 realtime report showing activity in the last 30 minutes. Common dimensions: country, city, deviceCategory, unifiedScreenName (page/screen), platform. Common metrics: activeUsers, screenPageViews, eventCount, conversions. |
google_analytics.google_analytics_report | Read read | 13 | Run a GA4 analytics report. Returns rows of dimension/metric data for the specified date range. Common dimensions: sessionSource, sessionMedium, sessionDefaultChannelGroup (traffic source); pagePath, pageTitle, landingPage (pages); country, city (geo); deviceCategory, browser, operatingSystem (device); date, dateHour, month (time); newVsReturning (user); eventName (events). Common metrics: sessions, totalUsers, newUsers, activeUsers (traffic); screenPageViews, bounceRate, averageSessionDuration, engagementRate, sessionsPerUser (engagement); eventCount, conversions (events); purchaseRevenue, totalRevenue (e-commerce). Dates: YYYY-MM-DD or relative: "today", "yesterday", "7daysAgo", "28daysAgo", "30daysAgo", "90daysAgo", "365daysAgo". Filter operators: exact, contains, begins_with, ends_with, regex, in_list. Metric filter operators: equal, less_than, greater_than, less_than_or_equal, greater_than_or_equal. |