1<?php
2/*
3 * Copyright 2014 Google Inc.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6 * use this file except in compliance with the License. You may obtain a copy of
7 * the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations under
15 * the License.
16 */
17
18namespace Google\Service\Analytics\Resource;
19
20use Google\Service\Analytics\GaData;
21
22/**
23 * The "ga" collection of methods.
24 * Typical usage is:
25 *  <code>
26 *   $analyticsService = new Google\Service\Analytics(...);
27 *   $ga = $analyticsService->ga;
28 *  </code>
29 */
30class DataGa extends \Google\Service\Resource
31{
32  /**
33   * Returns Analytics data for a view (profile). (ga.get)
34   *
35   * @param string $ids Unique table ID for retrieving Analytics data. Table ID is
36   * of the form ga:XXXX, where XXXX is the Analytics view (profile) ID.
37   * @param string $startDate Start date for fetching Analytics data. Requests can
38   * specify a start date formatted as YYYY-MM-DD, or as a relative date (e.g.,
39   * today, yesterday, or 7daysAgo). The default value is 7daysAgo.
40   * @param string $endDate End date for fetching Analytics data. Request can
41   * should specify an end date formatted as YYYY-MM-DD, or as a relative date
42   * (e.g., today, yesterday, or 7daysAgo). The default value is yesterday.
43   * @param string $metrics A comma-separated list of Analytics metrics. E.g.,
44   * 'ga:sessions,ga:pageviews'. At least one metric must be specified.
45   * @param array $optParams Optional parameters.
46   *
47   * @opt_param string dimensions A comma-separated list of Analytics dimensions.
48   * E.g., 'ga:browser,ga:city'.
49   * @opt_param string filters A comma-separated list of dimension or metric
50   * filters to be applied to Analytics data.
51   * @opt_param bool include-empty-rows The response will include empty rows if
52   * this parameter is set to true, the default is true
53   * @opt_param int max-results The maximum number of entries to include in this
54   * feed.
55   * @opt_param string output The selected format for the response. Default format
56   * is JSON.
57   * @opt_param string samplingLevel The desired sampling level.
58   * @opt_param string segment An Analytics segment to be applied to data.
59   * @opt_param string sort A comma-separated list of dimensions or metrics that
60   * determine the sort order for Analytics data.
61   * @opt_param int start-index An index of the first entity to retrieve. Use this
62   * parameter as a pagination mechanism along with the max-results parameter.
63   * @return GaData
64   */
65  public function get($ids, $startDate, $endDate, $metrics, $optParams = [])
66  {
67    $params = ['ids' => $ids, 'start-date' => $startDate, 'end-date' => $endDate, 'metrics' => $metrics];
68    $params = array_merge($params, $optParams);
69    return $this->call('get', [$params], GaData::class);
70  }
71}
72
73// Adding a class alias for backwards compatibility with the previous class name.
74class_alias(DataGa::class, 'Google_Service_Analytics_Resource_DataGa');
75