3030use Google \Analytics \Data \V1alpha \CreateAudienceListRequest ;
3131use Google \Analytics \Data \V1alpha \CreateRecurringAudienceListRequest ;
3232use Google \Analytics \Data \V1alpha \CreateReportTaskRequest ;
33+ use Google \Analytics \Data \V1alpha \Dimension ;
3334use Google \Analytics \Data \V1alpha \GetAudienceListRequest ;
35+ use Google \Analytics \Data \V1alpha \GetMetadataRequest ;
3436use Google \Analytics \Data \V1alpha \GetPropertyQuotasSnapshotRequest ;
3537use Google \Analytics \Data \V1alpha \GetRecurringAudienceListRequest ;
3638use Google \Analytics \Data \V1alpha \GetReportTaskRequest ;
3739use Google \Analytics \Data \V1alpha \ListAudienceListsRequest ;
3840use Google \Analytics \Data \V1alpha \ListRecurringAudienceListsRequest ;
3941use Google \Analytics \Data \V1alpha \ListReportTasksRequest ;
42+ use Google \Analytics \Data \V1alpha \Metadata ;
43+ use Google \Analytics \Data \V1alpha \Metric ;
4044use Google \Analytics \Data \V1alpha \PropertyQuotasSnapshot ;
4145use Google \Analytics \Data \V1alpha \QueryAudienceListRequest ;
4246use Google \Analytics \Data \V1alpha \QueryAudienceListResponse ;
4650use Google \Analytics \Data \V1alpha \ReportTask ;
4751use Google \Analytics \Data \V1alpha \RunFunnelReportRequest ;
4852use Google \Analytics \Data \V1alpha \RunFunnelReportResponse ;
53+ use Google \Analytics \Data \V1alpha \RunReportRequest ;
54+ use Google \Analytics \Data \V1alpha \RunReportResponse ;
4955use Google \Analytics \Data \V1alpha \Segment ;
50- use Google \Analytics \Data \V1alpha \SheetExportAudienceListRequest ;
51- use Google \Analytics \Data \V1alpha \SheetExportAudienceListResponse ;
5256use Google \ApiCore \ApiException ;
5357use Google \ApiCore \CredentialsWrapper ;
5458use Google \ApiCore \GapicClientTrait ;
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 = [])
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 */
96101final 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