analytics_report
Run a GA4 report read-only
Description
WHAT HAPPENED ON THE SITE — the GA4 Data API report, and the tool that answers "where is our traffic coming from", "which campaign converted", "which landing page is working". Pass metrics by name (activeUsers, sessions, screenPageViews, conversions, totalRevenue, engagementRate, bounceRate, averageSessionDuration …) and dimensions to break them down by (sessionDefaultChannelGroup, sessionSource / sessionMedium / sessionCampaignName, landingPage, pagePath, country, deviceCategory, date, eventName …). GA4 publishes hundreds of both and each property ships its OWN custom dimensions, so names are forwarded as given rather than validated against a copied list — use list_analytics_definitions to see a property's custom ones. THE PROPERTY IS A NUMERIC ID (e.g. 123456789), NOT the G-XXXXXXX Measurement ID — run list_analytics_properties to resolve it. Dates default to the last 28 days and accept either YYYY-MM-DD or GA4's relative forms ("28daysAgo", "yesterday", "today"). PERIOD OVER PERIOD IN ONE CALL: compare:"previous_period" (or "previous_year") adds the earlier period and returns per-period totals plus `change` (absolute + %) computed from GA4's own totals — quote it, never redo the maths; or pass up to 4 named dateRanges. comparisons put segments side by side; totals:true adds a total row. Rows come back as flat named objects. When GA4 says the data is SAMPLED, TRUNCATED, rolled into an "(other)" row or thresholded, completenessNotes says so in words; repeat those when reporting. Read-only, 0 credits.
Parameters
| Parameter | Type | Description |
|---|---|---|
propertyrequired | string | the NUMERIC GA4 property id from list_analytics_properties (e.g. "123456789") — never the G-XXXXXXX Measurement ID, and it must be one SHARED with this profile |
metrics | string[] | GA4 metric names — default ["activeUsers","sessions","screenPageViews"] |
dimensions | string[] | GA4 dimension names to break the metrics down by — omit for a single total row |
startDate | string | YYYY-MM-DD or a GA4 relative date like "28daysAgo" (default 28daysAgo) |
endDate | string | YYYY-MM-DD or "today" (default today) |
limit | number | rows to return, 1–250000 (default 50). 250,000 is GOOGLE's per-request maximum, not ours — asking for more is silently capped there. |
offset | number | skip this many rows — how you page past `limit`. Use the nextOffset the previous call returns. |
orderByMetric | string | sort by this metric — must be one of the metrics requested |
orderDesc | boolean | default true (largest first) when orderByMetric is set |
dimensionFilter | object | NARROW THE REPORT — a GA4 FilterExpression, exactly one of andGroup | orGroup | notExpression | filter. Without it a report is the WHOLE property. Example: {"filter":{"fieldName":"sessionSource","stringFilter":{"matchType":"EXACT","value":"google"}}}; combine with {"andGroup":{"expressions":[…]}}. METRICS CANNOT BE USED HERE — use metricFilter. |
metricFilter | object | Filter the AGGREGATED rows, GA4's having-clause — same FilterExpression shape. Example: {"filter":{"fieldName":"sessions","numericFilter":{"operation":"GREATER_THAN","value":{"int64Value":"30"}}}}. DIMENSIONS CANNOT BE USED HERE — use dimensionFilter. |
compare | "previous_period" | "previous_year" | also read the period before startDate–endDate (or the same dates a year earlier) and return `change` |
dateRanges | object[] | up to 4 periods instead of startDate/endDate; rows gain a dateRange column; with two, change = the FIRST relative to the SECOND |
dateRanges[].startDaterequired | string | period start, YYYY-MM-DD or a GA4 relative date such as 28daysAgo |
dateRanges[].endDaterequired | string | period end, YYYY-MM-DD or today |
dateRanges[].name | string | label for this period, shown in the dateRange column |
totals | boolean | add TOTAL rows |
aggregations | "TOTAL" | "MINIMUM" | "MAXIMUM" | "COUNT"[] | extra summary rows over the result: TOTAL, MINIMUM, MAXIMUM or COUNT |
comparisons | object[] | segments side by side: [{name, dimensionFilter}] or [{comparison:"comparisons/123"}]; adds a comparison column |
comparisons[].name | string | label for this segment; becomes the value of the comparison column |
comparisons[].dimensionFilter | object | FilterExpression selecting this segment, same shape as dimensionFilter |
comparisons[].comparison | string | saved GA4 comparison id such as comparisons/1234; use instead of name and dimensionFilter |
orderBy | object[] | [{dimension:"date"}] or [{metric:"sessions", desc:true}] |
orderBy[].dimension | string | dimension to sort by; use instead of metric |
orderBy[].metric | string | metric to sort by; use instead of dimension |
orderBy[].desc | boolean | true = largest or latest first |
orderBy[].orderType | "ALPHANUMERIC" | "CASE_INSENSITIVE_ALPHANUMERIC" | "NUMERIC" | dimension sort order: ALPHANUMERIC, CASE_INSENSITIVE_ALPHANUMERIC or NUMERIC |
keepEmptyRows | boolean | true = keep rows whose metrics are all zero |
currencyCode | string | ISO 4217, e.g. EUR — default the property currency |
Example call
Every required parameter is shown, filled from the schema where it gives a value and otherwise with a placeholder naming the type. Replace the placeholders with real values. The same call works on the MCP server, the CLI and POST https://app.hermoso.ai/v1/tools/analytics_report.
MCP (tools/call)
{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"analytics_report","arguments":{"property":"<string>"}}}
CLI
hermoso call analytics_report --json '{"property":"<string>"}'
Credits
Credits are spent only on two things: running an AI model (image, video, voice, text, planning, post-production) and Ad Spy research. See Credits & costs.
Related tools
list_analytics_definitionsList a GA4 property’s key events and custom dimensionslist_analytics_propertiesList the GA4 properties shared with this profileanalytics_realtimeWho is on the site right now (GA4 realtime)create_analytics_key_eventMark a GA4 event as a key event (conversion)create_analytics_custom_dimensionCreate a GA4 custom dimensionlist_analytics_metadataWhat a GA4 property can be askedarchive_analytics_custom_dimensionArchive a GA4 custom dimensiondelete_analytics_key_eventStop counting a GA4 event as a conversioncreate_analytics_custom_metricRegister a GA4 custom metricarchive_analytics_custom_metricArchive a GA4 custom metric (one-way)