KosmoKrator

analytics

Google Analytics CLI for Cron Jobs

Use the Google Analytics CLI for cron jobs with headless JSON commands, schema discovery, credentials, and permission controls.

4 functions 4 read 0 write OAuth browser flow auth

Google Analytics CLI for Cron Jobs

Schedule repeatable integration workflows from cron while keeping credentials in KosmoKrator config.

Use the headless CLI from cron when an operation should run without an interactive agent session. The Google Analytics CLI uses the same integration registry as the TUI, Lua runtime, and MCP gateway, but returns predictable command output for automation.

Command Shape

# Google Analytics CLI for Cron Jobs
kosmokrator integrations:configure google_analytics --set access_token="$GOOGLE_ANALYTICS_ACCESS_TOKEN" --enable --read allow --write ask --json
kosmo integrations:call google_analytics.google_analytics_list_properties '{}' --json

Discovery Before Execution

Agents and scripts can inspect Google Analytics docs and schemas before choosing a function.

kosmo integrations:docs google_analytics --json
kosmo integrations:docs google_analytics.google_analytics_list_properties --json
kosmo integrations:schema google_analytics.google_analytics_list_properties --json
kosmo integrations:search "Google Analytics" --json
kosmo integrations:list --json

Useful Google Analytics CLI Functions

FunctionTypeParametersDescription
google_analytics.google_analytics_list_properties Read none 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 property_id 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 property_id, metrics, dimensions, limit 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 property_id, metrics, dimensions, start_date, end_date, compare_start_date, compare_end_date, filters, metric_filters, order_by, order_direction, limit, offset 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.

Automation Notes

Related Google Analytics CLI Pages