Skip to content

Commit a430e29

Browse files
feat: [AnalyticsData] remove SheetExportAudienceList method, associated resources, and OAuth scopes from v1 alpha (#9145)
* fix!: remove SheetExportAudienceList method, associated resources, and OAuth scopes from v1 alpha feat: add RunReport and GetMetadata methods to v1 alpha feat: add Metadata, Comparison, ComparisonMetadata, and ConversionMetadata types to v1 alpha feat: add the ConversionSpec field to the RunReportRequest resource in v1 alpha feat: add the Section field to the ResponseMetaData resource in v1 alpha feat: add the conversions field to the Metadata response in v1 alpha feat: add the sections field to the DimensionMetadata in v1 alpha docs: update documentation for sampling_metadatas docs: update copyright year to 2026 in proto files PiperOrigin-RevId: 907145766 Source-Link: googleapis/googleapis@97bcfbd Source-Link: googleapis/googleapis-gen@f7d8b88 Copy-Tag: eyJwIjoiQW5hbHl0aWNzRGF0YS8uT3dsQm90LnlhbWwiLCJoIjoiZjdkOGI4ODRjMmQ0OWRjZTFhMjRiMDdjODdjOTg5MDk3NmQwMTVkMSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 43ef99a commit a430e29

25 files changed

Lines changed: 3545 additions & 87 deletions

AnalyticsData/metadata/V1Alpha/AnalyticsDataApi.php

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

AnalyticsData/metadata/V1Alpha/Data.php

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
<?php
2+
/*
3+
* Copyright 2026 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* https://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,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
/*
19+
* GENERATED CODE WARNING
20+
* This file was automatically generated - do not edit!
21+
*/
22+
23+
require_once __DIR__ . '/../../../vendor/autoload.php';
24+
25+
// [START analyticsdata_v1alpha_generated_AlphaAnalyticsData_GetMetadata_sync]
26+
use Google\Analytics\Data\V1alpha\Client\AlphaAnalyticsDataClient;
27+
use Google\Analytics\Data\V1alpha\GetMetadataRequest;
28+
use Google\Analytics\Data\V1alpha\Metadata;
29+
use Google\ApiCore\ApiException;
30+
31+
/**
32+
* Returns metadata for dimensions and metrics available in reporting methods.
33+
* Used to explore the dimensions and metrics. In this method, a Google
34+
* Analytics property identifier is specified in the request, and
35+
* the metadata response includes Custom dimensions and metrics as well as
36+
* Universal metadata.
37+
*
38+
* For example if a custom metric with parameter name `levels_unlocked` is
39+
* registered to a property, the Metadata response will contain
40+
* `customEvent:levels_unlocked`. Universal metadata are dimensions and
41+
* metrics applicable to any property such as `country` and `totalUsers`.
42+
*
43+
* @param string $formattedName The resource name of the metadata to retrieve. This name field is
44+
* specified in the URL path and not URL parameters. Property is a numeric
45+
* Google Analytics property identifier. To learn more, see [where to find
46+
* your Property
47+
* ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id).
48+
*
49+
* Example: properties/1234/metadata
50+
*
51+
* Set the Property ID to 0 for dimensions and metrics common to all
52+
* properties. In this special mode, this method will not return custom
53+
* dimensions and metrics. Please see
54+
* {@see AlphaAnalyticsDataClient::metadataName()} for help formatting this field.
55+
*/
56+
function get_metadata_sample(string $formattedName): void
57+
{
58+
// Create a client.
59+
$alphaAnalyticsDataClient = new AlphaAnalyticsDataClient();
60+
61+
// Prepare the request message.
62+
$request = (new GetMetadataRequest())
63+
->setName($formattedName);
64+
65+
// Call the API and handle any network failures.
66+
try {
67+
/** @var Metadata $response */
68+
$response = $alphaAnalyticsDataClient->getMetadata($request);
69+
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
70+
} catch (ApiException $ex) {
71+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
72+
}
73+
}
74+
75+
/**
76+
* Helper to execute the sample.
77+
*
78+
* This sample has been automatically generated and should be regarded as a code
79+
* template only. It will require modifications to work:
80+
* - It may require correct/in-range values for request initialization.
81+
* - It may require specifying regional endpoints when creating the service client,
82+
* please see the apiEndpoint client configuration option for more details.
83+
*/
84+
function callSample(): void
85+
{
86+
$formattedName = AlphaAnalyticsDataClient::metadataName('[PROPERTY]');
87+
88+
get_metadata_sample($formattedName);
89+
}
90+
// [END analyticsdata_v1alpha_generated_AlphaAnalyticsData_GetMetadata_sync]
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
<?php
2+
/*
3+
* Copyright 2026 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* https://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,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
/*
19+
* GENERATED CODE WARNING
20+
* This file was automatically generated - do not edit!
21+
*/
22+
23+
require_once __DIR__ . '/../../../vendor/autoload.php';
24+
25+
// [START analyticsdata_v1alpha_generated_AlphaAnalyticsData_RunReport_sync]
26+
use Google\Analytics\Data\V1alpha\Client\AlphaAnalyticsDataClient;
27+
use Google\Analytics\Data\V1alpha\RunReportRequest;
28+
use Google\Analytics\Data\V1alpha\RunReportResponse;
29+
use Google\ApiCore\ApiException;
30+
31+
/**
32+
* Returns a customized report of your Google Analytics event data. Reports
33+
* contain statistics derived from data collected by the Google Analytics
34+
* tracking code. The data returned from the API is as a table with columns
35+
* for the requested dimensions and metrics. Metrics are individual
36+
* measurements of user activity on your property, such as active users or
37+
* event count. Dimensions break down metrics across some common criteria,
38+
* such as country or event name.
39+
*
40+
* @param string $property A Google Analytics property identifier whose events are tracked.
41+
* Specified in the URL path and not the body. To learn more, see [where to
42+
* find your Property
43+
* ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id).
44+
* Within a batch request, this property should either be unspecified or
45+
* consistent with the batch-level property.
46+
*
47+
* Example: properties/1234
48+
*/
49+
function run_report_sample(string $property): void
50+
{
51+
// Create a client.
52+
$alphaAnalyticsDataClient = new AlphaAnalyticsDataClient();
53+
54+
// Prepare the request message.
55+
$request = (new RunReportRequest())
56+
->setProperty($property);
57+
58+
// Call the API and handle any network failures.
59+
try {
60+
/** @var RunReportResponse $response */
61+
$response = $alphaAnalyticsDataClient->runReport($request);
62+
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
63+
} catch (ApiException $ex) {
64+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
65+
}
66+
}
67+
68+
/**
69+
* Helper to execute the sample.
70+
*
71+
* This sample has been automatically generated and should be regarded as a code
72+
* template only. It will require modifications to work:
73+
* - It may require correct/in-range values for request initialization.
74+
* - It may require specifying regional endpoints when creating the service client,
75+
* please see the apiEndpoint client configuration option for more details.
76+
*/
77+
function callSample(): void
78+
{
79+
$property = '[PROPERTY]';
80+
81+
run_report_sample($property);
82+
}
83+
// [END analyticsdata_v1alpha_generated_AlphaAnalyticsData_RunReport_sync]

AnalyticsData/src/V1alpha/Client/AlphaAnalyticsDataClient.php

Lines changed: 78 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,17 @@
3030
use Google\Analytics\Data\V1alpha\CreateAudienceListRequest;
3131
use Google\Analytics\Data\V1alpha\CreateRecurringAudienceListRequest;
3232
use Google\Analytics\Data\V1alpha\CreateReportTaskRequest;
33+
use Google\Analytics\Data\V1alpha\Dimension;
3334
use Google\Analytics\Data\V1alpha\GetAudienceListRequest;
35+
use Google\Analytics\Data\V1alpha\GetMetadataRequest;
3436
use Google\Analytics\Data\V1alpha\GetPropertyQuotasSnapshotRequest;
3537
use Google\Analytics\Data\V1alpha\GetRecurringAudienceListRequest;
3638
use Google\Analytics\Data\V1alpha\GetReportTaskRequest;
3739
use Google\Analytics\Data\V1alpha\ListAudienceListsRequest;
3840
use Google\Analytics\Data\V1alpha\ListRecurringAudienceListsRequest;
3941
use Google\Analytics\Data\V1alpha\ListReportTasksRequest;
42+
use Google\Analytics\Data\V1alpha\Metadata;
43+
use Google\Analytics\Data\V1alpha\Metric;
4044
use Google\Analytics\Data\V1alpha\PropertyQuotasSnapshot;
4145
use Google\Analytics\Data\V1alpha\QueryAudienceListRequest;
4246
use Google\Analytics\Data\V1alpha\QueryAudienceListResponse;
@@ -46,9 +50,9 @@
4650
use Google\Analytics\Data\V1alpha\ReportTask;
4751
use Google\Analytics\Data\V1alpha\RunFunnelReportRequest;
4852
use Google\Analytics\Data\V1alpha\RunFunnelReportResponse;
53+
use Google\Analytics\Data\V1alpha\RunReportRequest;
54+
use Google\Analytics\Data\V1alpha\RunReportResponse;
4955
use Google\Analytics\Data\V1alpha\Segment;
50-
use Google\Analytics\Data\V1alpha\SheetExportAudienceListRequest;
51-
use Google\Analytics\Data\V1alpha\SheetExportAudienceListResponse;
5256
use Google\ApiCore\ApiException;
5357
use Google\ApiCore\CredentialsWrapper;
5458
use Google\ApiCore\GapicClientTrait;
@@ -82,6 +86,7 @@
8286
* @method PromiseInterface<RecurringAudienceList> createRecurringAudienceListAsync(CreateRecurringAudienceListRequest $request, array $optionalArgs = [])
8387
* @method PromiseInterface<OperationResponse> createReportTaskAsync(CreateReportTaskRequest $request, array $optionalArgs = [])
8488
* @method PromiseInterface<AudienceList> getAudienceListAsync(GetAudienceListRequest $request, array $optionalArgs = [])
89+
* @method PromiseInterface<Metadata> getMetadataAsync(GetMetadataRequest $request, array $optionalArgs = [])
8590
* @method PromiseInterface<PropertyQuotasSnapshot> getPropertyQuotasSnapshotAsync(GetPropertyQuotasSnapshotRequest $request, array $optionalArgs = [])
8691
* @method PromiseInterface<RecurringAudienceList> getRecurringAudienceListAsync(GetRecurringAudienceListRequest $request, array $optionalArgs = [])
8792
* @method PromiseInterface<ReportTask> getReportTaskAsync(GetReportTaskRequest $request, array $optionalArgs = [])
@@ -91,7 +96,7 @@
9196
* @method PromiseInterface<QueryAudienceListResponse> queryAudienceListAsync(QueryAudienceListRequest $request, array $optionalArgs = [])
9297
* @method PromiseInterface<QueryReportTaskResponse> queryReportTaskAsync(QueryReportTaskRequest $request, array $optionalArgs = [])
9398
* @method PromiseInterface<RunFunnelReportResponse> runFunnelReportAsync(RunFunnelReportRequest $request, array $optionalArgs = [])
94-
* @method PromiseInterface<SheetExportAudienceListResponse> sheetExportAudienceListAsync(SheetExportAudienceListRequest $request, array $optionalArgs = [])
99+
* @method PromiseInterface<RunReportResponse> runReportAsync(RunReportRequest $request, array $optionalArgs = [])
95100
*/
96101
final class AlphaAnalyticsDataClient
97102
{
@@ -121,9 +126,6 @@ final class AlphaAnalyticsDataClient
121126
public static $serviceScopes = [
122127
'https://www.googleapis.com/auth/analytics',
123128
'https://www.googleapis.com/auth/analytics.readonly',
124-
'https://www.googleapis.com/auth/drive',
125-
'https://www.googleapis.com/auth/drive.file',
126-
'https://www.googleapis.com/auth/spreadsheets',
127129
];
128130

129131
private $operationsClient;
@@ -218,6 +220,23 @@ public static function audienceListName(string $property, string $audienceList):
218220
]);
219221
}
220222

223+
/**
224+
* Formats a string containing the fully-qualified path to represent a metadata
225+
* resource.
226+
*
227+
* @param string $property
228+
*
229+
* @return string The formatted metadata resource.
230+
*
231+
* @experimental
232+
*/
233+
public static function metadataName(string $property): string
234+
{
235+
return self::getPathTemplate('metadata')->render([
236+
'property' => $property,
237+
]);
238+
}
239+
221240
/**
222241
* Formats a string containing the fully-qualified path to represent a property
223242
* resource.
@@ -295,6 +314,7 @@ public static function reportTaskName(string $property, string $reportTask): str
295314
* The following name formats are supported:
296315
* Template: Pattern
297316
* - audienceList: properties/{property}/audienceLists/{audience_list}
317+
* - metadata: properties/{property}/metadata
298318
* - property: properties/{property}
299319
* - propertyQuotasSnapshot: properties/{property}/propertyQuotasSnapshot
300320
* - recurringAudienceList: properties/{property}/recurringAudienceLists/{recurring_audience_list}
@@ -584,6 +604,43 @@ public function getAudienceList(GetAudienceListRequest $request, array $callOpti
584604
return $this->startApiCall('GetAudienceList', $request, $callOptions)->wait();
585605
}
586606

607+
/**
608+
* Returns metadata for dimensions and metrics available in reporting methods.
609+
* Used to explore the dimensions and metrics. In this method, a Google
610+
* Analytics property identifier is specified in the request, and
611+
* the metadata response includes Custom dimensions and metrics as well as
612+
* Universal metadata.
613+
*
614+
* For example if a custom metric with parameter name `levels_unlocked` is
615+
* registered to a property, the Metadata response will contain
616+
* `customEvent:levels_unlocked`. Universal metadata are dimensions and
617+
* metrics applicable to any property such as `country` and `totalUsers`.
618+
*
619+
* The async variant is {@see AlphaAnalyticsDataClient::getMetadataAsync()} .
620+
*
621+
* @example samples/V1alpha/AlphaAnalyticsDataClient/get_metadata.php
622+
*
623+
* @param GetMetadataRequest $request A request to house fields associated with the call.
624+
* @param array $callOptions {
625+
* Optional.
626+
*
627+
* @type RetrySettings|array $retrySettings
628+
* Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
629+
* associative array of retry settings parameters. See the documentation on
630+
* {@see RetrySettings} for example usage.
631+
* }
632+
*
633+
* @return Metadata
634+
*
635+
* @throws ApiException Thrown if the API call fails.
636+
*
637+
* @experimental
638+
*/
639+
public function getMetadata(GetMetadataRequest $request, array $callOptions = []): Metadata
640+
{
641+
return $this->startApiCall('GetMetadata', $request, $callOptions)->wait();
642+
}
643+
587644
/**
588645
* Get all property quotas organized by quota category for a given property.
589646
* This will charge 1 property quota from the category with the most quota.
@@ -921,33 +978,20 @@ public function runFunnelReport(RunFunnelReportRequest $request, array $callOpti
921978
}
922979

923980
/**
924-
* Exports an audience list of users to a Google Sheet. After creating an
925-
* audience, the users are not immediately available for listing. First, a
926-
* request to `CreateAudienceList` is necessary to create an audience list of
927-
* users, and then second, this method is used to export those users in the
928-
* audience list to a Google Sheet.
981+
* Returns a customized report of your Google Analytics event data. Reports
982+
* contain statistics derived from data collected by the Google Analytics
983+
* tracking code. The data returned from the API is as a table with columns
984+
* for the requested dimensions and metrics. Metrics are individual
985+
* measurements of user activity on your property, such as active users or
986+
* event count. Dimensions break down metrics across some common criteria,
987+
* such as country or event name.
929988
*
930-
* See [Creating an Audience
931-
* List](https://developers.google.com/analytics/devguides/reporting/data/v1/audience-list-basics)
932-
* for an introduction to Audience Lists with examples.
989+
* The async variant is {@see AlphaAnalyticsDataClient::runReportAsync()} .
933990
*
934-
* Audiences in Google Analytics 4 allow you to segment your users in the ways
935-
* that are important to your business. To learn more, see
936-
* https://support.google.com/analytics/answer/9267572.
937-
*
938-
* This method is introduced at alpha stability with the intention of
939-
* gathering feedback on syntax and capabilities before entering beta. To give
940-
* your feedback on this API, complete the
941-
* [Google Analytics Audience Export API
942-
* Feedback](https://forms.gle/EeA5u5LW6PEggtCEA) form.
943-
*
944-
* The async variant is
945-
* {@see AlphaAnalyticsDataClient::sheetExportAudienceListAsync()} .
991+
* @example samples/V1alpha/AlphaAnalyticsDataClient/run_report.php
946992
*
947-
* @example samples/V1alpha/AlphaAnalyticsDataClient/sheet_export_audience_list.php
948-
*
949-
* @param SheetExportAudienceListRequest $request A request to house fields associated with the call.
950-
* @param array $callOptions {
993+
* @param RunReportRequest $request A request to house fields associated with the call.
994+
* @param array $callOptions {
951995
* Optional.
952996
*
953997
* @type RetrySettings|array $retrySettings
@@ -956,16 +1000,14 @@ public function runFunnelReport(RunFunnelReportRequest $request, array $callOpti
9561000
* {@see RetrySettings} for example usage.
9571001
* }
9581002
*
959-
* @return SheetExportAudienceListResponse
1003+
* @return RunReportResponse
9601004
*
9611005
* @throws ApiException Thrown if the API call fails.
9621006
*
9631007
* @experimental
9641008
*/
965-
public function sheetExportAudienceList(
966-
SheetExportAudienceListRequest $request,
967-
array $callOptions = []
968-
): SheetExportAudienceListResponse {
969-
return $this->startApiCall('SheetExportAudienceList', $request, $callOptions)->wait();
1009+
public function runReport(RunReportRequest $request, array $callOptions = []): RunReportResponse
1010+
{
1011+
return $this->startApiCall('RunReport', $request, $callOptions)->wait();
9701012
}
9711013
}

0 commit comments

Comments
 (0)