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