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\AnalyticsData\Resource;
19
20use Google\Service\AnalyticsData\BatchRunPivotReportsRequest;
21use Google\Service\AnalyticsData\BatchRunPivotReportsResponse;
22use Google\Service\AnalyticsData\BatchRunReportsRequest;
23use Google\Service\AnalyticsData\BatchRunReportsResponse;
24use Google\Service\AnalyticsData\CheckCompatibilityRequest;
25use Google\Service\AnalyticsData\CheckCompatibilityResponse;
26use Google\Service\AnalyticsData\Metadata;
27use Google\Service\AnalyticsData\RunPivotReportRequest;
28use Google\Service\AnalyticsData\RunPivotReportResponse;
29use Google\Service\AnalyticsData\RunRealtimeReportRequest;
30use Google\Service\AnalyticsData\RunRealtimeReportResponse;
31use Google\Service\AnalyticsData\RunReportRequest;
32use Google\Service\AnalyticsData\RunReportResponse;
33
34/**
35 * The "properties" collection of methods.
36 * Typical usage is:
37 *  <code>
38 *   $analyticsdataService = new Google\Service\AnalyticsData(...);
39 *   $properties = $analyticsdataService->properties;
40 *  </code>
41 */
42class Properties extends \Google\Service\Resource
43{
44  /**
45   * Returns multiple pivot reports in a batch. All reports must be for the same
46   * GA4 Property. (properties.batchRunPivotReports)
47   *
48   * @param string $property A Google Analytics GA4 property identifier whose
49   * events are tracked. Specified in the URL path and not the body. To learn
50   * more, see [where to find your Property
51   * ID](https://developers.google.com/analytics/devguides/reporting/data/v1
52   * /property-id). This property must be specified for the batch. The property
53   * within RunPivotReportRequest may either be unspecified or consistent with
54   * this property. Example: properties/1234
55   * @param BatchRunPivotReportsRequest $postBody
56   * @param array $optParams Optional parameters.
57   * @return BatchRunPivotReportsResponse
58   */
59  public function batchRunPivotReports($property, BatchRunPivotReportsRequest $postBody, $optParams = [])
60  {
61    $params = ['property' => $property, 'postBody' => $postBody];
62    $params = array_merge($params, $optParams);
63    return $this->call('batchRunPivotReports', [$params], BatchRunPivotReportsResponse::class);
64  }
65  /**
66   * Returns multiple reports in a batch. All reports must be for the same GA4
67   * Property. (properties.batchRunReports)
68   *
69   * @param string $property A Google Analytics GA4 property identifier whose
70   * events are tracked. Specified in the URL path and not the body. To learn
71   * more, see [where to find your Property
72   * ID](https://developers.google.com/analytics/devguides/reporting/data/v1
73   * /property-id). This property must be specified for the batch. The property
74   * within RunReportRequest may either be unspecified or consistent with this
75   * property. Example: properties/1234
76   * @param BatchRunReportsRequest $postBody
77   * @param array $optParams Optional parameters.
78   * @return BatchRunReportsResponse
79   */
80  public function batchRunReports($property, BatchRunReportsRequest $postBody, $optParams = [])
81  {
82    $params = ['property' => $property, 'postBody' => $postBody];
83    $params = array_merge($params, $optParams);
84    return $this->call('batchRunReports', [$params], BatchRunReportsResponse::class);
85  }
86  /**
87   * This compatibility method lists dimensions and metrics that can be added to a
88   * report request and maintain compatibility. This method fails if the request's
89   * dimensions and metrics are incompatible. In Google Analytics, reports fail if
90   * they request incompatible dimensions and/or metrics; in that case, you will
91   * need to remove dimensions and/or metrics from the incompatible report until
92   * the report is compatible. The Realtime and Core reports have different
93   * compatibility rules. This method checks compatibility for Core reports.
94   * (properties.checkCompatibility)
95   *
96   * @param string $property A Google Analytics GA4 property identifier whose
97   * events are tracked. To learn more, see [where to find your Property
98   * ID](https://developers.google.com/analytics/devguides/reporting/data/v1
99   * /property-id). `property` should be the same value as in your `runReport`
100   * request. Example: properties/1234 Set the Property ID to 0 for compatibility
101   * checking on dimensions and metrics common to all properties. In this special
102   * mode, this method will not return custom dimensions and metrics.
103   * @param CheckCompatibilityRequest $postBody
104   * @param array $optParams Optional parameters.
105   * @return CheckCompatibilityResponse
106   */
107  public function checkCompatibility($property, CheckCompatibilityRequest $postBody, $optParams = [])
108  {
109    $params = ['property' => $property, 'postBody' => $postBody];
110    $params = array_merge($params, $optParams);
111    return $this->call('checkCompatibility', [$params], CheckCompatibilityResponse::class);
112  }
113  /**
114   * Returns metadata for dimensions and metrics available in reporting methods.
115   * Used to explore the dimensions and metrics. In this method, a Google
116   * Analytics GA4 Property Identifier is specified in the request, and the
117   * metadata response includes Custom dimensions and metrics as well as Universal
118   * metadata. For example if a custom metric with parameter name
119   * `levels_unlocked` is registered to a property, the Metadata response will
120   * contain `customEvent:levels_unlocked`. Universal metadata are dimensions and
121   * metrics applicable to any property such as `country` and `totalUsers`.
122   * (properties.getMetadata)
123   *
124   * @param string $name Required. The resource name of the metadata to retrieve.
125   * This name field is specified in the URL path and not URL parameters. Property
126   * is a numeric Google Analytics GA4 Property identifier. To learn more, see
127   * [where to find your Property
128   * ID](https://developers.google.com/analytics/devguides/reporting/data/v1
129   * /property-id). Example: properties/1234/metadata Set the Property ID to 0 for
130   * dimensions and metrics common to all properties. In this special mode, this
131   * method will not return custom dimensions and metrics.
132   * @param array $optParams Optional parameters.
133   * @return Metadata
134   */
135  public function getMetadata($name, $optParams = [])
136  {
137    $params = ['name' => $name];
138    $params = array_merge($params, $optParams);
139    return $this->call('getMetadata', [$params], Metadata::class);
140  }
141  /**
142   * Returns a customized pivot report of your Google Analytics event data. Pivot
143   * reports are more advanced and expressive formats than regular reports. In a
144   * pivot report, dimensions are only visible if they are included in a pivot.
145   * Multiple pivots can be specified to further dissect your data.
146   * (properties.runPivotReport)
147   *
148   * @param string $property A Google Analytics GA4 property identifier whose
149   * events are tracked. Specified in the URL path and not the body. To learn
150   * more, see [where to find your Property
151   * ID](https://developers.google.com/analytics/devguides/reporting/data/v1
152   * /property-id). Within a batch request, this property should either be
153   * unspecified or consistent with the batch-level property. Example:
154   * properties/1234
155   * @param RunPivotReportRequest $postBody
156   * @param array $optParams Optional parameters.
157   * @return RunPivotReportResponse
158   */
159  public function runPivotReport($property, RunPivotReportRequest $postBody, $optParams = [])
160  {
161    $params = ['property' => $property, 'postBody' => $postBody];
162    $params = array_merge($params, $optParams);
163    return $this->call('runPivotReport', [$params], RunPivotReportResponse::class);
164  }
165  /**
166   * The Google Analytics Realtime API returns a customized report of realtime
167   * event data for your property. These reports show events and usage from the
168   * last 30 minutes. For a guide to constructing realtime requests &
169   * understanding responses, see [Creating a Realtime
170   * Report](https://developers.google.com/analytics/devguides/reporting/data/v1
171   * /realtime-basics). (properties.runRealtimeReport)
172   *
173   * @param string $property A Google Analytics GA4 property identifier whose
174   * events are tracked. Specified in the URL path and not the body. To learn
175   * more, see [where to find your Property
176   * ID](https://developers.google.com/analytics/devguides/reporting/data/v1
177   * /property-id). Example: properties/1234
178   * @param RunRealtimeReportRequest $postBody
179   * @param array $optParams Optional parameters.
180   * @return RunRealtimeReportResponse
181   */
182  public function runRealtimeReport($property, RunRealtimeReportRequest $postBody, $optParams = [])
183  {
184    $params = ['property' => $property, 'postBody' => $postBody];
185    $params = array_merge($params, $optParams);
186    return $this->call('runRealtimeReport', [$params], RunRealtimeReportResponse::class);
187  }
188  /**
189   * Returns a customized report of your Google Analytics event data. Reports
190   * contain statistics derived from data collected by the Google Analytics
191   * tracking code. The data returned from the API is as a table with columns for
192   * the requested dimensions and metrics. Metrics are individual measurements of
193   * user activity on your property, such as active users or event count.
194   * Dimensions break down metrics across some common criteria, such as country or
195   * event name. For a guide to constructing requests & understanding responses,
196   * see [Creating a Report](https://developers.google.com/analytics/devguides/rep
197   * orting/data/v1/basics). (properties.runReport)
198   *
199   * @param string $property A Google Analytics GA4 property identifier whose
200   * events are tracked. Specified in the URL path and not the body. To learn
201   * more, see [where to find your Property
202   * ID](https://developers.google.com/analytics/devguides/reporting/data/v1
203   * /property-id). Within a batch request, this property should either be
204   * unspecified or consistent with the batch-level property. Example:
205   * properties/1234
206   * @param RunReportRequest $postBody
207   * @param array $optParams Optional parameters.
208   * @return RunReportResponse
209   */
210  public function runReport($property, RunReportRequest $postBody, $optParams = [])
211  {
212    $params = ['property' => $property, 'postBody' => $postBody];
213    $params = array_merge($params, $optParams);
214    return $this->call('runReport', [$params], RunReportResponse::class);
215  }
216}
217
218// Adding a class alias for backwards compatibility with the previous class name.
219class_alias(Properties::class, 'Google_Service_AnalyticsData_Resource_Properties');
220