KosmoKrator

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_code OAuth browser flow
cli_setup_supported
true
cli_runtime_supported
true
mcp_gateway_supported
true
lua_supported
true
supports_multi_account
false

Quick Links

Google Analytics MCP Client Matrix

Use these pages when a specific agent client or framework needs copy-pasteable MCP setup for Google Analytics.

Google Analytics CLI Matrix

Use these pages for direct Google Analytics CLI workflows in scripts, CI, cron, and agent wrappers.

Function Catalog

FunctionTypeParametersDescription
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.