checkCompatibility method

Future<CheckCompatibilityResponse> checkCompatibility(
  1. CheckCompatibilityRequest request,
  2. String property, {
  3. String? $fields,
})

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.

request - The metadata request object.

Request parameters:

property - A Google Analytics GA4 property identifier whose events are tracked. To learn more, see where to find your Property ID. property should be the same value as in your runReport request. Example: properties/1234 Value must have pattern ^properties/\[^/\]+$.

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

Completes with a CheckCompatibilityResponse.

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<CheckCompatibilityResponse> checkCompatibility(
  CheckCompatibilityRequest request,
  core.String property, {
  core.String? $fields,
}) async {
  final body_ = convert.json.encode(request);
  final queryParams_ = <core.String, core.List<core.String>>{
    if ($fields != null) 'fields': [$fields],
  };

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

  final response_ = await _requester.request(
    url_,
    'POST',
    body: body_,
    queryParams: queryParams_,
  );
  return CheckCompatibilityResponse.fromJson(
      response_ as core.Map<core.String, core.dynamic>);
}