ga4_run_funnel_report

Run GA4 Funnel Report

Ga4

Description

Run an ordered, multi-step funnel (Data API v1alpha runFunnelReport) — the only way to measure step sequence, "no intervening events", and time-bounded steps. For non-sequential dimension x metric reporting use ga4_run_report instead. Each step matches either an event or a dimension value, or a depth-1 and_group/or_group of both — e.g. "a page_view AND hostName = app.example.com". Cross-domain journeys are expressed by filtering hostName per step. Args: property_id (string, required): GA4 property ID (numeric) or full resource name. date_ranges (array, required): 1-4 ranges of { start_date, end_date, name? }. Use several to compare periods (e.g. week over week) in ONE call — this is the cheapest way to do it. steps (array, required): 2-10 ordered steps. Each is { name?, filter_expression, is_directly_followed_by?, within_duration_seconds? }. filter_expression is exactly one of: { funnel_event_filter: { event_name } } { funnel_field_filter: { field_name, string_filter | in_list_filter | numeric_filter | between_filter } } { and_group: { expressions: [...] } } | { or_group: { expressions: [...] } } { not_expression: <single condition> } is_directly_followed_by: true means NO intervening events at all, not merely ordering. within_duration_seconds: complete this step within N seconds of the previous one. is_open_funnel (bool, optional): false (default) = users must enter at step 1; true = users may enter at any step. This changes the numbers a lot — the value actually used is echoed back as is_open_funnel. visualization_type (string, optional): STANDARD_FUNNEL (default) or TRENDED_FUNNEL. TRENDED_FUNNEL adds a date dimension to funnel_visualization, which carries activeUsers ONLY — completion and abandonment rates live in funnel_table. funnel_breakdown (object, optional): { breakdown_dimension, limit? } splits each step by a dimension. limit caps at 15. Adds a RESERVED_TOTAL row per step which is the across-all-values total, NOT a data row. funnel_next_action (object, optional): { next_action_dimension, limit? } — what users did next; appears in funnel_visualization. limit caps at 5. limit (number, optional): caps rows returned. There is no pagination and no total row count, so if you get back exactly that many rows the result may be silently truncated — raise the limit or narrow the funnel rather than assuming that is all the data. Defaults to 250; GA4 itself would return up to 10,000. Row count multiplies across steps x breakdown values x date ranges. return_property_quota (bool, optional). Field names: funnel steps validate against GA4's exploration schema, which is NOT the same list ga4_get_metadata returns. Common valid dimensions include hostName, pagePath, sessionSource, sessionMedium, deviceCategory, country. Returns: property_id and date_ranges — echoed back, so multi-range rows (which GA4 labels date_range_0, date_range_1, ...) can be mapped to the windows you asked for. is_open_funnel — which semantics produced these numbers. funnel_table — { returned_rows, data } with funnelStepName, any breakdown dimension, activeUsers, funnelStepCompletionRate, funnelStepAbandonments, funnelStepAbandonmentRate. funnel_visualization — { returned_rows, data } with activeUsers only. Always present; for a STANDARD_FUNNEL with no next-action it is a subset of funnel_table, so read funnel_table for rates, plus date under TRENDED_FUNNEL. warnings — present when the funnel spans hostnames (GA4 stitches identity across domains only if cross-domain measurement was configured at collection time; it cannot be fixed at query time). Notes: steps no user reached are omitted entirely, so rows may be fewer than steps. There is no pagination — runFunnelReport has no offset.

Read-onlyOpen-world

Usage

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "ga4_run_funnel_report",
    "arguments": {
      "property_id": "123456789",
      "date_ranges": [
        {
          "start_date": "28daysAgo",
          "end_date": "yesterday"
        }
      ],
      "steps": [
        {
          "name": "Visited site",
          "filter_expression": {
            "funnel_event_filter": {
              "event_name": "page_view"
            }
          }
        },
        {
          "name": "Started signup",
          "filter_expression": {
            "funnel_event_filter": {
              "event_name": "sign_up_start"
            }
          }
        },
        {
          "name": "Completed signup",
          "filter_expression": {
            "funnel_event_filter": {
              "event_name": "sign_up"
            }
          }
        }
      ],
      "reason": "Find which signup step loses the most users"
    }
  }
}

Parameters

NameTypeRequiredDescription
property_id string Required GA4 property ID (numeric) or full resource name.minLength: 1
date_ranges array Required One to 4 date ranges. Use several to compare periods (e.g. week over week) in a single call.
steps array Required Ordered funnel steps (2-10).
reason string Required Why this tool call is neededminLength: 1, maxLength: 500
Optional parameters (7)
NameTypeRequiredDescription
is_open_funnel boolean Optional Open funnel: users may enter at any step. Closed (default): users must enter at step 1. This changes the numbers substantially; the resolved value is echoed in the response.
visualization_type string Optional TRENDED_FUNNEL adds a date dimension to funnel_visualization (activeUsers only).
STANDARD_FUNNEL TRENDED_FUNNEL
funnel_breakdown object Optional
funnel_next_action object Optional
limit integer Optional Max rows returned.min: 1, max: 10000
return_property_quota boolean Optional Include the property quota state in the response.
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

Three-step signup funnel

{
  "property_id": "123456789",
  "date_ranges": [
    {
      "start_date": "28daysAgo",
      "end_date": "yesterday"
    }
  ],
  "steps": [
    {
      "name": "Visited site",
      "filter_expression": {
        "funnel_event_filter": {
          "event_name": "page_view"
        }
      }
    },
    {
      "name": "Started signup",
      "filter_expression": {
        "funnel_event_filter": {
          "event_name": "sign_up_start"
        }
      }
    },
    {
      "name": "Completed signup",
      "filter_expression": {
        "funnel_event_filter": {
          "event_name": "sign_up"
        }
      }
    }
  ],
  "reason": "Find which signup step loses the most users"
}

hopkin ga4 funnel-report --property-id 123456789 --date-ranges [object Object] --steps [object Object],[object Object],[object Object]

Cross-domain funnel with per-step hostnames

{
  "property_id": "123456789",
  "date_ranges": [
    {
      "start_date": "28daysAgo",
      "end_date": "yesterday"
    }
  ],
  "steps": [
    {
      "name": "Marketing site",
      "filter_expression": {
        "and_group": {
          "expressions": [
            {
              "funnel_event_filter": {
                "event_name": "page_view"
              }
            },
            {
              "funnel_field_filter": {
                "field_name": "hostName",
                "string_filter": {
                  "value": "example.com"
                }
              }
            }
          ]
        }
      }
    },
    {
      "name": "App subdomain",
      "filter_expression": {
        "and_group": {
          "expressions": [
            {
              "funnel_event_filter": {
                "event_name": "page_view"
              }
            },
            {
              "funnel_field_filter": {
                "field_name": "hostName",
                "string_filter": {
                  "value": "app.example.com"
                }
              }
            }
          ]
        }
      }
    }
  ],
  "funnel_breakdown": {
    "breakdown_dimension": "hostName",
    "limit": 5
  },
  "reason": "Measure the marketing-site to app hand-off"
}

hopkin ga4 funnel-report --property-id 123456789 --date-ranges [object Object] --steps [object Object],[object Object] --funnel-breakdown [object Object]

Week-over-week comparison in one call

{
  "property_id": "123456789",
  "date_ranges": [
    {
      "start_date": "14daysAgo",
      "end_date": "8daysAgo",
      "name": "prior_week"
    },
    {
      "start_date": "7daysAgo",
      "end_date": "yesterday",
      "name": "last_week"
    }
  ],
  "steps": [
    {
      "name": "Session",
      "filter_expression": {
        "funnel_event_filter": {
          "event_name": "session_start"
        }
      }
    },
    {
      "name": "Purchase",
      "filter_expression": {
        "funnel_event_filter": {
          "event_name": "purchase"
        }
      }
    }
  ],
  "reason": "Compare purchase funnel across the last two weeks"
}

hopkin ga4 funnel-report --property-id 123456789 --date-ranges [object Object],[object Object] --steps [object Object],[object Object]