getMetadata method

Future<Metadata> getMetadata(
  1. String name, {
  2. String? $fields,
})

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.

Request parameters:

name - 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. 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. Value must have pattern ^properties/\[^/\]+/metadata$.

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

Completes with a Metadata.

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<Metadata> getMetadata(
  core.String name, {
  core.String? $fields,
}) async {
  final _queryParams = <core.String, core.List<core.String>>{
    if ($fields != null) 'fields': [$fields],
  };

  final _url = 'v1beta/' + core.Uri.encodeFull('$name');

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