{"files":{"SKILL.md":"---\nname: google-analytics-data-api\ndescription: \"Google Analytics Data API skill. Use when working with Google Analytics Data for v1beta. Covers 7 endpoints.\"\nversion: 1.0.0\ngenerator: lapsh\n---\n\n# Google Analytics Data API\nAPI version: v1beta\n\n## Auth\nOAuth2 | OAuth2\n\n## Base URL\nhttps://analyticsdata.googleapis.com/\n\n## Setup\n1. Configure auth: OAuth2 | OAuth2\n2. GET /v1beta/{name} -- returns metadata for dimensions and metrics available in reporting methods. used to explore the dimensions and metrics. in this method, a google analytics ga4 property identifier is specified in the request, and the metadata response includes custom dimensions and metrics as well as universal metadata. for example if a custom metric with parameter name `levels_unlocked` is registered to a property, the metadata response will contain `customevent:levels_unlocked`. universal metadata are dimensions and metrics applicable to any property such as `country` and `totalusers`.\n3. POST /v1beta/{property}:batchRunPivotReports -- create first v1beta\n\n## Endpoints\n7 endpoints across 1 group. See references/api-spec.lap for full details.\n\n### V1beta\n| Method | Path | Description |\n|--------|------|-------------|\n| GET | /v1beta/{name} | Returns metadata for dimensions and metrics available in reporting methods. Used to explore the dimensions and metrics. In this method, a Google Analytics GA4 Property Identifier is specified in the request, and the metadata response includes Custom dimensions and metrics as well as Universal metadata. For example if a custom metric with parameter name `levels_unlocked` is registered to a property, the Metadata response will contain `customEvent:levels_unlocked`. Universal metadata are dimensions and metrics applicable to any property such as `country` and `totalUsers`. |\n| POST | /v1beta/{property}:batchRunPivotReports | Returns multiple pivot reports in a batch. All reports must be for the same GA4 Property. |\n| POST | /v1beta/{property}:batchRunReports | Returns multiple reports in a batch. All reports must be for the same GA4 Property. |\n| POST | /v1beta/{property}:checkCompatibility | This compatibility method lists dimensions and metrics that can be added to a report request and maintain compatibility. This method fails if the request's dimensions and metrics are incompatible. In Google Analytics, reports fail if they request incompatible dimensions and/or metrics; in that case, you will need to remove dimensions and/or metrics from the incompatible report until the report is compatible. The Realtime and Core reports have different compatibility rules. This method checks compatibility for Core reports. |\n| POST | /v1beta/{property}:runPivotReport | Returns a customized pivot report of your Google Analytics event data. Pivot reports are more advanced and expressive formats than regular reports. In a pivot report, dimensions are only visible if they are included in a pivot. Multiple pivots can be specified to further dissect your data. |\n| POST | /v1beta/{property}:runRealtimeReport | Returns a customized report of realtime event data for your property. Events appear in realtime reports seconds after they have been sent to the Google Analytics. Realtime reports show events and usage data for the periods of time ranging from the present moment to 30 minutes ago (up to 60 minutes for Google Analytics 360 properties). For a guide to constructing realtime requests & understanding responses, see [Creating a Realtime Report](https://developers.google.com/analytics/devguides/reporting/data/v1/realtime-basics). |\n| POST | /v1beta/{property}:runReport | Returns a customized report of your Google Analytics event data. Reports contain statistics derived from data collected by the Google Analytics tracking code. The data returned from the API is as a table with columns for the requested dimensions and metrics. Metrics are individual measurements of user activity on your property, such as active users or event count. Dimensions break down metrics across some common criteria, such as country or event name. For a guide to constructing requests & understanding responses, see [Creating a Report](https://developers.google.com/analytics/devguides/reporting/data/v1/basics). |\n\n## Common Questions\nMatch user requests to endpoints in references/api-spec.lap. Key patterns:\n- \"Get v1beta details?\" -> GET /v1beta/{name}\n- \"How to authenticate?\" -> See Auth section above\n\n## Response Tips\n- Check response schemas in references/api-spec.lap for field details\n- Paginated endpoints accept limit/offset or cursor parameters\n- Create/update endpoints return the modified resource on success\n\n## References\n- Full spec: See references/api-spec.lap for complete endpoint details, parameter tables, and response schemas\n\n> Generated from the official API spec by [LAP](https://lap.sh)\n","references/api-spec.lap":"@lap v0.3\n# Machine-readable API spec. Each @endpoint block is one API call.\n@api Google Analytics Data API\n@base https://analyticsdata.googleapis.com/\n@version v1beta\n@auth OAuth2 | OAuth2\n@endpoints 7\n@toc v1beta(7)\n\n@endpoint GET /v1beta/{name}\n@desc Returns metadata for dimensions and metrics available in reporting methods. Used to explore the dimensions and metrics. In this method, a Google Analytics GA4 Property Identifier is specified in the request, and the metadata response includes Custom dimensions and metrics as well as Universal metadata. For example if a custom metric with parameter name `levels_unlocked` is registered to a property, the Metadata response will contain `customEvent:levels_unlocked`. Universal metadata are dimensions and metrics applicable to any property such as `country` and `totalUsers`.\n@required {name: str # Required. The resource name of the metadata to retrieve. This name field is specified in the URL path and not URL parameters. Property is a numeric Google Analytics GA4 Property identifier. To learn more, see [where to find your Property ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id). Example: properties/1234/metadata Set the Property ID to 0 for dimensions and metrics common to all properties. In this special mode, this method will not return custom dimensions and metrics.}\n@returns(200) {dimensions: [map], metrics: [map], name: str} # Successful response\n\n@endpoint POST /v1beta/{property}:batchRunPivotReports\n@desc Returns multiple pivot reports in a batch. All reports must be for the same GA4 Property.\n@required {property: str # A Google Analytics GA4 property identifier whose events are tracked. Specified in the URL path and not the body. To learn more, see [where to find your Property ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id). This property must be specified for the batch. The property within RunPivotReportRequest may either be unspecified or consistent with this property. Example: properties/1234}\n@optional {requests: [map{cohortSpec: map, currencyCode: str, dateRanges: [map], dimensionFilter: map, dimensions: [map], keepEmptyRows: bool, metricFilter: map, metrics: [map], pivots: [map], property: str, returnPropertyQuota: bool}] # Individual requests. Each request has a separate pivot report response. Each batch request is allowed up to 5 requests.}\n@returns(200) {kind: str, pivotReports: [map]} # Successful response\n\n@endpoint POST /v1beta/{property}:batchRunReports\n@desc Returns multiple reports in a batch. All reports must be for the same GA4 Property.\n@required {property: str # A Google Analytics GA4 property identifier whose events are tracked. Specified in the URL path and not the body. To learn more, see [where to find your Property ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id). This property must be specified for the batch. The property within RunReportRequest may either be unspecified or consistent with this property. Example: properties/1234}\n@optional {requests: [map{cohortSpec: map, currencyCode: str, dateRanges: [map], dimensionFilter: map, dimensions: [map], keepEmptyRows: bool, limit: str(int64), metricAggregations: [str], metricFilter: map, metrics: [map], offset: str(int64), orderBys: [map], property: str, returnPropertyQuota: bool}] # Individual requests. Each request has a separate report response. Each batch request is allowed up to 5 requests.}\n@returns(200) {kind: str, reports: [map]} # Successful response\n\n@endpoint POST /v1beta/{property}:checkCompatibility\n@desc This compatibility method lists dimensions and metrics that can be added to a report request and maintain compatibility. This method fails if the request's dimensions and metrics are incompatible. In Google Analytics, reports fail if they request incompatible dimensions and/or metrics; in that case, you will need to remove dimensions and/or metrics from the incompatible report until the report is compatible. The Realtime and Core reports have different compatibility rules. This method checks compatibility for Core reports.\n@required {property: str # A Google Analytics GA4 property identifier whose events are tracked. To learn more, see [where to find your Property ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id). `property` should be the same value as in your `runReport` request. Example: properties/1234}\n@optional {compatibilityFilter: str(COMPATIBILITY_UNSPECIFIED/COMPATIBLE/INCOMPATIBLE) # Filters the dimensions and metrics in the response to just this compatibility. Commonly used as `”compatibilityFilter”: “COMPATIBLE”` to only return compatible dimensions & metrics., dimensionFilter: map{andGroup: map, filter: map, notExpression: map, orGroup: map} # To express dimension or metric filters. The fields in the same FilterExpression need to be either all dimensions or all metrics., dimensions: [map{dimensionExpression: map, name: str}] # The dimensions in this report. `dimensions` should be the same value as in your `runReport` request., metricFilter: map{andGroup: map, filter: map, notExpression: map, orGroup: map} # To express dimension or metric filters. The fields in the same FilterExpression need to be either all dimensions or all metrics., metrics: [map{expression: str, invisible: bool, name: str}] # The metrics in this report. `metrics` should be the same value as in your `runReport` request.}\n@returns(200) {dimensionCompatibilities: [map], metricCompatibilities: [map]} # Successful response\n\n@endpoint POST /v1beta/{property}:runPivotReport\n@desc Returns a customized pivot report of your Google Analytics event data. Pivot reports are more advanced and expressive formats than regular reports. In a pivot report, dimensions are only visible if they are included in a pivot. Multiple pivots can be specified to further dissect your data.\n@required {property: str # A Google Analytics GA4 property identifier whose events are tracked. Specified in the URL path and not the body. To learn more, see [where to find your Property ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id). Within a batch request, this property should either be unspecified or consistent with the batch-level property. Example: properties/1234}\n@optional {cohortSpec: map{cohortReportSettings: map, cohorts: [map], cohortsRange: map} # The specification of cohorts for a cohort report. Cohort reports create a time series of user retention for the cohort. For example, you could select the cohort of users that were acquired in the first week of September and follow that cohort for the next six weeks. Selecting the users acquired in the first week of September cohort is specified in the `cohort` object. Following that cohort for the next six weeks is specified in the `cohortsRange` object. For examples, see [Cohort Report Examples](https://developers.google.com/analytics/devguides/reporting/data/v1/advanced#cohort_report_examples). The report response could show a weekly time series where say your app has retained 60% of this cohort after three weeks and 25% of this cohort after six weeks. These two percentages can be calculated by the metric `cohortActiveUsers/cohortTotalUsers` and will be separate rows in the report., currencyCode: str # A currency code in ISO4217 format, such as \"AED\", \"USD\", \"JPY\". If the field is empty, the report uses the property's default currency., dateRanges: [map{endDate: str, name: str, startDate: str}] # The date range to retrieve event data for the report. If multiple date ranges are specified, event data from each date range is used in the report. A special dimension with field name \"dateRange\" can be included in a Pivot's field names; if included, the report compares between date ranges. In a cohort request, this `dateRanges` must be unspecified., dimensionFilter: map{andGroup: map, filter: map, notExpression: map, orGroup: map} # To express dimension or metric filters. The fields in the same FilterExpression need to be either all dimensions or all metrics., dimensions: [map{dimensionExpression: map, name: str}] # The dimensions requested. All defined dimensions must be used by one of the following: dimension_expression, dimension_filter, pivots, order_bys., keepEmptyRows: bool # If false or unspecified, each row with all metrics equal to 0 will not be returned. If true, these rows will be returned if they are not separately removed by a filter. Regardless of this `keep_empty_rows` setting, only data recorded by the Google Analytics (GA4) property can be displayed in a report. For example if a property never logs a `purchase` event, then a query for the `eventName` dimension and `eventCount` metric will not have a row eventName: \"purchase\" and eventCount: 0., metricFilter: map{andGroup: map, filter: map, notExpression: map, orGroup: map} # To express dimension or metric filters. The fields in the same FilterExpression need to be either all dimensions or all metrics., metrics: [map{expression: str, invisible: bool, name: str}] # The metrics requested, at least one metric needs to be specified. All defined metrics must be used by one of the following: metric_expression, metric_filter, order_bys., pivots: [map{fieldNames: [str], limit: str(int64), metricAggregations: [str], offset: str(int64), orderBys: [map]}] # Describes the visual format of the report's dimensions in columns or rows. The union of the fieldNames (dimension names) in all pivots must be a subset of dimension names defined in Dimensions. No two pivots can share a dimension. A dimension is only visible if it appears in a pivot., property: str # A Google Analytics GA4 property identifier whose events are tracked. Specified in the URL path and not the body. To learn more, see [where to find your Property ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id). Within a batch request, this property should either be unspecified or consistent with the batch-level property. Example: properties/1234, returnPropertyQuota: bool # Toggles whether to return the current state of this Analytics Property's quota. Quota is returned in [PropertyQuota](#PropertyQuota).}\n@returns(200) {aggregates: [map], dimensionHeaders: [map], kind: str, metadata: map{currencyCode: str, dataLossFromOtherRow: bool, emptyReason: str, schemaRestrictionResponse: map{activeMetricRestrictions: [map]}, subjectToThresholding: bool, timeZone: str}, metricHeaders: [map], pivotHeaders: [map], propertyQuota: map{concurrentRequests: map{consumed: int(int32), remaining: int(int32)}, potentiallyThresholdedRequestsPerHour: map{consumed: int(int32), remaining: int(int32)}, serverErrorsPerProjectPerHour: map{consumed: int(int32), remaining: int(int32)}, tokensPerDay: map{consumed: int(int32), remaining: int(int32)}, tokensPerHour: map{consumed: int(int32), remaining: int(int32)}, tokensPerProjectPerHour: map{consumed: int(int32), remaining: int(int32)}}, rows: [map]} # Successful response\n\n@endpoint POST /v1beta/{property}:runRealtimeReport\n@desc Returns a customized report of realtime event data for your property. Events appear in realtime reports seconds after they have been sent to the Google Analytics. Realtime reports show events and usage data for the periods of time ranging from the present moment to 30 minutes ago (up to 60 minutes for Google Analytics 360 properties). For a guide to constructing realtime requests & understanding responses, see [Creating a Realtime Report](https://developers.google.com/analytics/devguides/reporting/data/v1/realtime-basics).\n@required {property: str # A Google Analytics GA4 property identifier whose events are tracked. Specified in the URL path and not the body. To learn more, see [where to find your Property ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id). Example: properties/1234}\n@optional {dimensionFilter: map{andGroup: map, filter: map, notExpression: map, orGroup: map} # To express dimension or metric filters. The fields in the same FilterExpression need to be either all dimensions or all metrics., dimensions: [map{dimensionExpression: map, name: str}] # The dimensions requested and displayed., limit: str(int64) # The number of rows to return. If unspecified, 10,000 rows are returned. The API returns a maximum of 250,000 rows per request, no matter how many you ask for. `limit` must be positive. The API can also return fewer rows than the requested `limit`, if there aren't as many dimension values as the `limit`. For instance, there are fewer than 300 possible values for the dimension `country`, so when reporting on only `country`, you can't get more than 300 rows, even if you set `limit` to a higher value., metricAggregations: [str] # Aggregation of metrics. Aggregated metric values will be shown in rows where the dimension_values are set to \"RESERVED_(MetricAggregation)\"., metricFilter: map{andGroup: map, filter: map, notExpression: map, orGroup: map} # To express dimension or metric filters. The fields in the same FilterExpression need to be either all dimensions or all metrics., metrics: [map{expression: str, invisible: bool, name: str}] # The metrics requested and displayed., minuteRanges: [map{endMinutesAgo: int(int32), name: str, startMinutesAgo: int(int32)}] # The minute ranges of event data to read. If unspecified, one minute range for the last 30 minutes will be used. If multiple minute ranges are requested, each response row will contain a zero based minute range index. If two minute ranges overlap, the event data for the overlapping minutes is included in the response rows for both minute ranges., orderBys: [map{desc: bool, dimension: map, metric: map, pivot: map}] # Specifies how rows are ordered in the response., returnPropertyQuota: bool # Toggles whether to return the current state of this Analytics Property's Realtime quota. Quota is returned in [PropertyQuota](#PropertyQuota).}\n@returns(200) {dimensionHeaders: [map], kind: str, maximums: [map], metricHeaders: [map], minimums: [map], propertyQuota: map{concurrentRequests: map{consumed: int(int32), remaining: int(int32)}, potentiallyThresholdedRequestsPerHour: map{consumed: int(int32), remaining: int(int32)}, serverErrorsPerProjectPerHour: map{consumed: int(int32), remaining: int(int32)}, tokensPerDay: map{consumed: int(int32), remaining: int(int32)}, tokensPerHour: map{consumed: int(int32), remaining: int(int32)}, tokensPerProjectPerHour: map{consumed: int(int32), remaining: int(int32)}}, rowCount: int(int32), rows: [map], totals: [map]} # Successful response\n\n@endpoint POST /v1beta/{property}:runReport\n@desc Returns a customized report of your Google Analytics event data. Reports contain statistics derived from data collected by the Google Analytics tracking code. The data returned from the API is as a table with columns for the requested dimensions and metrics. Metrics are individual measurements of user activity on your property, such as active users or event count. Dimensions break down metrics across some common criteria, such as country or event name. For a guide to constructing requests & understanding responses, see [Creating a Report](https://developers.google.com/analytics/devguides/reporting/data/v1/basics).\n@required {property: str # A Google Analytics GA4 property identifier whose events are tracked. Specified in the URL path and not the body. To learn more, see [where to find your Property ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id). Within a batch request, this property should either be unspecified or consistent with the batch-level property. Example: properties/1234}\n@optional {cohortSpec: map{cohortReportSettings: map, cohorts: [map], cohortsRange: map} # The specification of cohorts for a cohort report. Cohort reports create a time series of user retention for the cohort. For example, you could select the cohort of users that were acquired in the first week of September and follow that cohort for the next six weeks. Selecting the users acquired in the first week of September cohort is specified in the `cohort` object. Following that cohort for the next six weeks is specified in the `cohortsRange` object. For examples, see [Cohort Report Examples](https://developers.google.com/analytics/devguides/reporting/data/v1/advanced#cohort_report_examples). The report response could show a weekly time series where say your app has retained 60% of this cohort after three weeks and 25% of this cohort after six weeks. These two percentages can be calculated by the metric `cohortActiveUsers/cohortTotalUsers` and will be separate rows in the report., currencyCode: str # A currency code in ISO4217 format, such as \"AED\", \"USD\", \"JPY\". If the field is empty, the report uses the property's default currency., dateRanges: [map{endDate: str, name: str, startDate: str}] # Date ranges of data to read. If multiple date ranges are requested, each response row will contain a zero based date range index. If two date ranges overlap, the event data for the overlapping days is included in the response rows for both date ranges. In a cohort request, this `dateRanges` must be unspecified., dimensionFilter: map{andGroup: map, filter: map, notExpression: map, orGroup: map} # To express dimension or metric filters. The fields in the same FilterExpression need to be either all dimensions or all metrics., dimensions: [map{dimensionExpression: map, name: str}] # The dimensions requested and displayed., keepEmptyRows: bool # If false or unspecified, each row with all metrics equal to 0 will not be returned. If true, these rows will be returned if they are not separately removed by a filter. Regardless of this `keep_empty_rows` setting, only data recorded by the Google Analytics (GA4) property can be displayed in a report. For example if a property never logs a `purchase` event, then a query for the `eventName` dimension and `eventCount` metric will not have a row eventName: \"purchase\" and eventCount: 0., limit: str(int64) # The number of rows to return. If unspecified, 10,000 rows are returned. The API returns a maximum of 250,000 rows per request, no matter how many you ask for. `limit` must be positive. The API can also return fewer rows than the requested `limit`, if there aren't as many dimension values as the `limit`. For instance, there are fewer than 300 possible values for the dimension `country`, so when reporting on only `country`, you can't get more than 300 rows, even if you set `limit` to a higher value. To learn more about this pagination parameter, see [Pagination](https://developers.google.com/analytics/devguides/reporting/data/v1/basics#pagination)., metricAggregations: [str] # Aggregation of metrics. Aggregated metric values will be shown in rows where the dimension_values are set to \"RESERVED_(MetricAggregation)\"., metricFilter: map{andGroup: map, filter: map, notExpression: map, orGroup: map} # To express dimension or metric filters. The fields in the same FilterExpression need to be either all dimensions or all metrics., metrics: [map{expression: str, invisible: bool, name: str}] # The metrics requested and displayed., offset: str(int64) # The row count of the start row. The first row is counted as row 0. When paging, the first request does not specify offset; or equivalently, sets offset to 0; the first request returns the first `limit` of rows. The second request sets offset to the `limit` of the first request; the second request returns the second `limit` of rows. To learn more about this pagination parameter, see [Pagination](https://developers.google.com/analytics/devguides/reporting/data/v1/basics#pagination)., orderBys: [map{desc: bool, dimension: map, metric: map, pivot: map}] # Specifies how rows are ordered in the response., property: str # A Google Analytics GA4 property identifier whose events are tracked. Specified in the URL path and not the body. To learn more, see [where to find your Property ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id). Within a batch request, this property should either be unspecified or consistent with the batch-level property. Example: properties/1234, returnPropertyQuota: bool # Toggles whether to return the current state of this Analytics Property's quota. Quota is returned in [PropertyQuota](#PropertyQuota).}\n@returns(200) {dimensionHeaders: [map], kind: str, maximums: [map], metadata: map{currencyCode: str, dataLossFromOtherRow: bool, emptyReason: str, schemaRestrictionResponse: map{activeMetricRestrictions: [map]}, subjectToThresholding: bool, timeZone: str}, metricHeaders: [map], minimums: [map], propertyQuota: map{concurrentRequests: map{consumed: int(int32), remaining: int(int32)}, potentiallyThresholdedRequestsPerHour: map{consumed: int(int32), remaining: int(int32)}, serverErrorsPerProjectPerHour: map{consumed: int(int32), remaining: int(int32)}, tokensPerDay: map{consumed: int(int32), remaining: int(int32)}, tokensPerHour: map{consumed: int(int32), remaining: int(int32)}, tokensPerProjectPerHour: map{consumed: int(int32), remaining: int(int32)}}, rowCount: int(int32), rows: [map], totals: [map]} # Successful response\n\n@end\n"}}