runPivotReport method

Future<RunPivotReportResponse> runPivotReport(
  1. RunPivotReportRequest request,
  2. String property, {
  3. String? $fields,
})

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.

request - The metadata request object.

Request parameters:

property - 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. Within a batch request, this property should either be unspecified or consistent with the batch-level property. Example: properties/1234 Value must have pattern ^properties/\[^/\]+$.

$fields - Selector specifying which fields to include in a partial response.

Completes with a RunPivotReportResponse.

Completes with a commons.ApiRequestError if the API endpoint returned an error.

If the used http.Client completes with an error when making a REST call, this method will complete with the same error.

Implementation

async.Future<RunPivotReportResponse> runPivotReport(
  RunPivotReportRequest request,
  core.String property, {
  core.String? $fields,
}) async {
  final _body = convert.json.encode(request.toJson());
  final _queryParams = <core.String, core.List<core.String>>{
    if ($fields != null) 'fields': [$fields],
  };

  final _url =
      'v1beta/' + core.Uri.encodeFull('$property') + ':runPivotReport';

  final _response = await _requester.request(
    _url,
    'POST',
    body: _body,
    queryParams: _queryParams,
  );
  return RunPivotReportResponse.fromJson(
      _response as core.Map<core.String, core.dynamic>);
}