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.

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.

Agent Surfaces

Machine-Readable Metadata

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.
google-analytics.google_analytics_check_compatibility Read read 6 Check whether GA4 dimensions and metrics can be combined in a report request.
google-analytics.google_analytics_pivot_report Read read 9 Run a GA4 pivot report for advanced cross-tabbed dimension and metric analysis.
google-analytics.google_analytics_batch_run_reports Read read 2 Run multiple GA4 standard report requests in one batchRunReports call.
google-analytics.google_analytics_batch_run_pivot_reports Read read 2 Run multiple GA4 pivot report requests in one batchRunPivotReports call.