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>);
}