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 Set the Property ID to 0 for compatibility checking on dimensions and metrics common to all properties. In this special mode, this method will not return custom dimensions and metrics. 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.toJson());
  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>);
}