ga4_run_report
Run GA4 Report
Ga4Description
Run a GA4 report (Data API runReport): arbitrary dimensions × metrics over one or more date ranges, with filtering, ordering and acquisition cohorts. Use ga4_get_metadata first to look up valid dimension/metric API names. For ORDERED, step-by-step funnels use ga4_run_funnel_report instead — runReport cannot express sequence. Args: property_id (string, required): GA4 property ID (numeric) or full resource name. dimensions (string[], optional): Up to 9 dimension API names (e.g. sessionDefaultChannelGroup, date). metrics (string[], required): 1-10 metric API names (e.g. sessions, totalUsers, keyEvents, purchaseRevenue). date_ranges (array, required unless cohort_spec is used): 1-4 ranges of { start_date, end_date, name? }. Dates are YYYY-MM-DD or relative (30daysAgo, yesterday, today). dimension_filter (object, optional): A filter expression — exactly one of: { filter: { field_name, string_filter | in_list_filter | numeric_filter | between_filter } } { and_group: { expressions: [ <leaf>, ... ] } } // all must hold { or_group: { expressions: [ <leaf>, ... ] } } // any must hold { not_expression: <leaf> } where <leaf> is { filter: {...} } or { not_expression: { filter: {...} } }. string_filter: { value, match_type?: EXACT|BEGINS_WITH|ENDS_WITH|CONTAINS|FULL_REGEXP|PARTIAL_REGEXP, case_sensitive? } Groups do not nest — one level of and/or over leaves. metric_filter (object, optional): Same shape, applied to metric values after aggregation (use numeric_filter / between_filter). cohort_spec (object, optional): Acquisition cohorts. { cohorts: [{ name?, date_range: { start_date, end_date } }], cohorts_range: { granularity: DAILY|WEEKLY|MONTHLY, start_offset?, end_offset } } Cohort reports REQUIRE the "cohort" dimension and must OMIT date_ranges — the cohort's own date_range defines the window. Pair with cohortNthDay/cohortNthWeek/cohortNthMonth and a metric such as cohortActiveUsers. order_by (object, optional): { type: 'metric'|'dimension', name, desc? }. limit (number, optional): Max rows, default 100, max 10000. offset (number, optional): Row offset for pagination. Returns: data — the rows, flattened as { dimension: value, metric: value } objects. Plus row_count (total rows before pagination) and returned_rows. For a single date range: metric_totals ({ metric: total }). For multiple date ranges: metric_totals_by_range ({ "date_range_0": { metric: total }, ... }) keyed by the dateRange dimension value (or the range's name).
Usage
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "ga4_run_report",
"arguments": {
"property_id": "123456789",
"dimensions": [
"sessionDefaultChannelGroup"
],
"metrics": [
"sessions",
"totalUsers",
"keyEvents"
],
"date_ranges": [
{
"start_date": "30daysAgo",
"end_date": "yesterday"
}
],
"reason": "Channel mix overview for the last 30 days"
}
}
}
hopkin ga4 report
| Flag | Type | Required | Description |
|---|---|---|---|
--property-id | string | Required | GA4 property ID (numeric) or full resource name. |
--dimensions | array | Optional | GA4 dimension API names, e.g. sessionDefaultChannelGroup, landingPagePlusQueryString, date. Use ga4_get_metadata for valid names. Cohort reports must include "cohort". |
--metrics | array | Required | GA4 metric API names, e.g. sessions, totalUsers, keyEvents, purchaseRevenue. |
--date-ranges | array | Optional | One to 4 date ranges. Omit only for cohort reports, where cohort_spec defines the window. |
--dimension-filter | object | Optional | Filter on dimension values. One of and_group / or_group / filter / not_expression. |
--metric-filter | object | Optional | Filter on metric values (applied after aggregation). Same shape as dimension_filter; use numeric_filter or between_filter. |
--cohort-spec | object | Optional | Acquisition-cohort report. Requires the "cohort" dimension; pair with cohortActiveUsers or cohortTotalUsers, and cohortNthDay/Week/Month to see periods. |
--order-by | object | Optional | |
--limit | integer | Optional | Max rows (default 100). Range: 1-10000. |
--offset | integer | Optional | Row offset for pagination. |
--connection-id | string | Optional | Optional ID of a specific connection to use for this call. Omit to use the actor's default connection for this network. Call <platform>_list_connections to discover available connection IDs. |
{
"mcpServers": {
"ga4": {
"url": "https://ga4.mcp.hopkin.ai",
"transport": "sse"
}
}
}
- Sessions by channel (30 days)
- Landing page revenue, filtered
- Weekly acquisition cohorts
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
property_id |
string |
Required | GA4 property ID (numeric) or full resource name.minLength: 1 |
metrics |
array |
Required | GA4 metric API names, e.g. sessions, totalUsers, keyEvents, purchaseRevenue. |
reason |
string |
Required | Why this tool call is neededminLength: 1, maxLength: 500 |
Optional parameters (9)
| Name | Type | Required | Description |
|---|---|---|---|
dimensions |
array |
Optional | GA4 dimension API names, e.g. sessionDefaultChannelGroup, landingPagePlusQueryString, date. Use ga4_get_metadata for valid names. Cohort reports must include "cohort". |
date_ranges |
array |
Optional | One to 4 date ranges. Omit only for cohort reports, where cohort_spec defines the window. |
dimension_filter |
object |
Optional | Filter on dimension values. One of and_group / or_group / filter / not_expression. |
metric_filter |
object |
Optional | Filter on metric values (applied after aggregation). Same shape as dimension_filter; use numeric_filter or between_filter. |
cohort_spec |
object |
Optional | Acquisition-cohort report. Requires the "cohort" dimension; pair with cohortActiveUsers or cohortTotalUsers, and cohortNthDay/Week/Month to see periods. |
order_by |
object |
Optional | |
limit |
integer |
Optional | Max rows (default 100). Range: 1-10000.min: 1, max: 10000 |
offset |
integer |
Optional | Row offset for pagination.min: 0 |
connection_id |
string |
Optional | Optional ID of a specific connection to use for this call. Omit to use the actor's default connection for this network. Call <platform>_list_connections to discover available connection IDs. |
Examples
Sessions by channel (30 days)
{
"property_id": "123456789",
"dimensions": [
"sessionDefaultChannelGroup"
],
"metrics": [
"sessions",
"totalUsers",
"keyEvents"
],
"date_ranges": [
{
"start_date": "30daysAgo",
"end_date": "yesterday"
}
],
"reason": "Channel mix overview for the last 30 days"
}
hopkin ga4 report --property-id 123456789 --dimensions sessionDefaultChannelGroup --metrics sessions,totalUsers,keyEvents --date-ranges [object Object]
Landing page revenue, filtered
{
"property_id": "123456789",
"dimensions": [
"landingPagePlusQueryString"
],
"metrics": [
"sessions",
"purchaseRevenue"
],
"date_ranges": [
{
"start_date": "2024-01-01",
"end_date": "2024-01-31"
}
],
"dimension_filter": {
"filter": {
"field_name": "sessionDefaultChannelGroup",
"string_filter": {
"value": "Paid Search"
}
}
},
"order_by": {
"type": "metric",
"name": "purchaseRevenue"
},
"limit": 25,
"reason": "Top paid-search landing pages by revenue"
}
hopkin ga4 report --property-id 123456789 --dimensions landingPagePlusQueryString --metrics sessions,purchaseRevenue --date-ranges [object Object] --dimension-filter [object Object] --order-by [object Object] --limit 25
Weekly acquisition cohorts
{
"property_id": "123456789",
"dimensions": [
"cohort",
"cohortNthWeek"
],
"metrics": [
"cohortActiveUsers"
],
"cohort_spec": {
"cohorts": [
{
"name": "week_of_jul_6",
"date_range": {
"start_date": "2026-07-06",
"end_date": "2026-07-12"
}
}
],
"cohorts_range": {
"granularity": "WEEKLY",
"start_offset": 0,
"end_offset": 3
}
},
"reason": "Retention of the users acquired in the week of Jul 6"
}
hopkin ga4 report --property-id 123456789 --dimensions cohort,cohortNthWeek --metrics cohortActiveUsers --cohort-spec [object Object]