getLinkStats method

Future<DynamicLinkStats> getLinkStats(
  1. String dynamicLink, {
  2. String? durationDays,
  3. String? sdkVersion,
  4. String? $fields,
})

Fetches analytics stats of a short Dynamic Link for a given duration.

Metrics include number of clicks, redirects, installs, app first opens, and app reopens.

Request parameters:

dynamicLink - Dynamic Link URL. e.g. https://abcd.app.goo.gl/wxyz

durationDays - The span of time requested in days.

sdkVersion - Google SDK version. Version takes the form "$major.$minor.$patch"

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

Completes with a DynamicLinkStats.

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

  final _url = 'v1/' + commons.escapeVariable('$dynamicLink') + '/linkStats';

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