Run GA4 pivot report
run_pivot_reportCross-tabulate Google Analytics 4 metrics by dimensions in up to three pivots with filters and date ranges to compare segment performance.
Instructions
Run a pivot (cross-tab) report. Every dimension must appear in exactly one pivot's fieldNames. Example: pivots [{fieldNames:["country"],limit:5},{fieldNames:["deviceCategory"],limit:3}] with metric sessions.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pivots | Yes | ||
| metrics | Yes | Metric API names, e.g. ["activeUsers","sessions","keyEvents","totalRevenue"]. | |
| property | No | GA4 property: numeric ID ("123456789"), resource name ("properties/123456789") or display name ("My Website"). Defaults to GA4_DEFAULT_PROPERTY if set. | |
| dateRanges | No | Up to 4 date ranges. Defaults to the last 28 days (28daysAgo → yesterday). | |
| dimensions | Yes | ||
| currencyCode | No | ISO 4217 code, e.g. "USD". Defaults to the property currency. | |
| metricFilter | No | A GA4 Data API FilterExpression object. Examples: {"filter":{"fieldName":"country","stringFilter":{"matchType":"EXACT","value":"United States"}}} {"filter":{"fieldName":"eventName","inListFilter":{"values":["purchase","sign_up"]}}} {"filter":{"fieldName":"sessions","numericFilter":{"operation":"GREATER_THAN","value":{"int64Value":"100"}}}} {"andGroup":{"expressions":[<expr>,<expr>]}} · {"orGroup":{"expressions":[...]}} · {"notExpression":<expr>} stringFilter.matchType: EXACT | BEGINS_WITH | ENDS_WITH | CONTAINS | FULL_REGEXP | PARTIAL_REGEXP. Use dimension fields in dimensionFilter and metric fields in metricFilter. | |
| keepEmptyRows | No | ||
| dimensionFilter | No | A GA4 Data API FilterExpression object. Examples: {"filter":{"fieldName":"country","stringFilter":{"matchType":"EXACT","value":"United States"}}} {"filter":{"fieldName":"eventName","inListFilter":{"values":["purchase","sign_up"]}}} {"filter":{"fieldName":"sessions","numericFilter":{"operation":"GREATER_THAN","value":{"int64Value":"100"}}}} {"andGroup":{"expressions":[<expr>,<expr>]}} · {"orGroup":{"expressions":[...]}} · {"notExpression":<expr>} stringFilter.matchType: EXACT | BEGINS_WITH | ENDS_WITH | CONTAINS | FULL_REGEXP | PARTIAL_REGEXP. Use dimension fields in dimensionFilter and metric fields in metricFilter. |