get method

Future<McfData> get(
  1. String ids,
  2. String startDate,
  3. String endDate,
  4. String metrics, {
  5. String? dimensions,
  6. String? filters,
  7. int? maxResults,
  8. String? samplingLevel,
  9. String? sort,
  10. int? startIndex,
  11. String? $fields,
})

Returns Analytics Multi-Channel Funnels data for a view (profile).

Request parameters:

ids - Unique table ID for retrieving Analytics data. Table ID is of the form ga:XXXX, where XXXX is the Analytics view (profile) ID. Value must have pattern ga:\[0-9\]+.

startDate - Start date for fetching Analytics data. Requests can specify a start date formatted as YYYY-MM-DD, or as a relative date (e.g., today, yesterday, or 7daysAgo). The default value is 7daysAgo. Value must have pattern \[0-9\]{4}-\[0-9\]{2}-\[0-9\]{2}|today|yesterday|\[0-9\]+(daysAgo).

endDate - End date for fetching Analytics data. Requests can specify a start date formatted as YYYY-MM-DD, or as a relative date (e.g., today, yesterday, or 7daysAgo). The default value is 7daysAgo. Value must have pattern \[0-9\]{4}-\[0-9\]{2}-\[0-9\]{2}|today|yesterday|\[0-9\]+(daysAgo).

metrics - A comma-separated list of Multi-Channel Funnels metrics. E.g., 'mcf:totalConversions,mcf:totalConversionValue'. At least one metric must be specified. Value must have pattern mcf:.+.

dimensions - A comma-separated list of Multi-Channel Funnels dimensions. E.g., 'mcf:source,mcf:medium'. Value must have pattern (mcf:.+)?.

filters - A comma-separated list of dimension or metric filters to be applied to the Analytics data. Value must have pattern mcf:.+.

maxResults - The maximum number of entries to include in this feed.

samplingLevel - The desired sampling level. Possible string values are:

  • "DEFAULT" : Returns response with a sample size that balances speed and accuracy.
  • "FASTER" : Returns a fast response with a smaller sample size.
  • "HIGHER_PRECISION" : Returns a more accurate response using a large sample size, but this may result in the response being slower.

sort - A comma-separated list of dimensions or metrics that determine the sort order for the Analytics data. Value must have pattern (-)?mcf:.+.

startIndex - An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.

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

Completes with a McfData.

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<McfData> get(
  core.String ids,
  core.String startDate,
  core.String endDate,
  core.String metrics, {
  core.String? dimensions,
  core.String? filters,
  core.int? maxResults,
  core.String? samplingLevel,
  core.String? sort,
  core.int? startIndex,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    'ids': [ids],
    'start-date': [startDate],
    'end-date': [endDate],
    'metrics': [metrics],
    if (dimensions != null) 'dimensions': [dimensions],
    if (filters != null) 'filters': [filters],
    if (maxResults != null) 'max-results': ['${maxResults}'],
    if (samplingLevel != null) 'samplingLevel': [samplingLevel],
    if (sort != null) 'sort': [sort],
    if (startIndex != null) 'start-index': ['${startIndex}'],
    if ($fields != null) 'fields': [$fields],
  };

  const url_ = 'data/mcf';

  final response_ = await _requester.request(
    url_,
    'GET',
    queryParams: queryParams_,
  );
  return McfData.fromJson(response_ as core.Map<core.String, core.dynamic>);
}