queryMetrics method
Query the metrics for an item.
Request parameters:
name - Required. The name of the item to query the metrics for. Format:
publishers/{publisher}/items/{item}
Value must have pattern ^publishers/\[^/\]+/items/\[^/\]+$.
dimensions - Optional. Dimensions to slice the metrics by. At most one
dimension can be specified. Supported dimensions: - os: The operating
system of the user. - app-version: The version of the item. - country: The
country of the user. - install-source: The source of the install. -
install-type: The type of install (from webstore, inline, or other). -
language: The language of the user. - enabled: If the item is enabled or
disabled. - utm-campaign: The UTM campaign of the user. - utm-content: The
UTM content of the user. - utm-medium: The UTM medium of the user. -
utm-source: The UTM source of the user. - utm-term: The UTM term of the
user.
metrics - Required. The metrics to query the metric set for. Supported
metrics: - installs: Count of item installs. - installs-7d: Count of
item installs in the last 7 days. - uninstalls: Count of item uninstalls.
- users: Count of daily active users of the item. - users-7d: Count of 7-day active users of the item. - impressions: Count of item impressions across the entire store front. - page-views: Count of individual views of the item's detail page.
pageSize - Optional. The maximum number of rows to return. If
unspecified, at most 100 rows will be returned. The maximum value is 1000;
Values above 1000 will be coerced to 1000.
pageToken - Optional. A page token, received from a previous call.
Provide this to retrieve the subsequent page. When paginating, all other
parameters provided to the request must match the call that provided the
page token.
timeSpec_firstDate_day - Day of a month. Must be from 1 to 31 and valid
for the year and month, or 0 to specify a year by itself or a year and
month where the day isn't significant.
timeSpec_firstDate_month - Month of a year. Must be from 1 to 12, or 0
to specify a year without a month and day.
timeSpec_firstDate_year - Year of the date. Must be from 1 to 9999, or 0
to specify a date without a year.
timeSpec_lastDate_day - Day of a month. Must be from 1 to 31 and valid
for the year and month, or 0 to specify a year by itself or a year and
month where the day isn't significant.
timeSpec_lastDate_month - Month of a year. Must be from 1 to 12, or 0 to
specify a year without a month and day.
timeSpec_lastDate_year - Year of the date. Must be from 1 to 9999, or 0
to specify a date without a year.
$fields - Selector specifying which fields to include in a partial
response.
Completes with a QueryItemMetricsResponse.
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<QueryItemMetricsResponse> queryMetrics(
core.String name, {
core.List<core.String>? dimensions,
core.List<core.String>? metrics,
core.int? pageSize,
core.String? pageToken,
core.int? timeSpec_firstDate_day,
core.int? timeSpec_firstDate_month,
core.int? timeSpec_firstDate_year,
core.int? timeSpec_lastDate_day,
core.int? timeSpec_lastDate_month,
core.int? timeSpec_lastDate_year,
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
'dimensions': ?dimensions,
'metrics': ?metrics,
'pageSize': ?pageSize == null ? null : ['${pageSize}'],
'pageToken': ?pageToken == null ? null : [pageToken],
'timeSpec.firstDate.day': ?timeSpec_firstDate_day == null
? null
: ['${timeSpec_firstDate_day}'],
'timeSpec.firstDate.month': ?timeSpec_firstDate_month == null
? null
: ['${timeSpec_firstDate_month}'],
'timeSpec.firstDate.year': ?timeSpec_firstDate_year == null
? null
: ['${timeSpec_firstDate_year}'],
'timeSpec.lastDate.day': ?timeSpec_lastDate_day == null
? null
: ['${timeSpec_lastDate_day}'],
'timeSpec.lastDate.month': ?timeSpec_lastDate_month == null
? null
: ['${timeSpec_lastDate_month}'],
'timeSpec.lastDate.year': ?timeSpec_lastDate_year == null
? null
: ['${timeSpec_lastDate_year}'],
'fields': ?$fields == null ? null : [$fields],
};
final url_ = 'v2/' + core.Uri.encodeFull('$name') + ':queryMetrics';
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
);
return QueryItemMetricsResponse.fromJson(
response_ as core.Map<core.String, core.dynamic>,
);
}