• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2023 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15syntax = "proto3";
16
17package google.analytics.data.v1beta;
18
19import "google/analytics/data/v1beta/data.proto";
20import "google/api/annotations.proto";
21import "google/api/client.proto";
22import "google/api/field_behavior.proto";
23import "google/api/resource.proto";
24import "google/longrunning/operations.proto";
25import "google/protobuf/timestamp.proto";
26
27option go_package = "google.golang.org/genproto/googleapis/analytics/data/v1beta;data";
28option java_multiple_files = true;
29option java_outer_classname = "AnalyticsDataApiProto";
30option java_package = "com.google.analytics.data.v1beta";
31option (google.api.resource_definition) = {
32  type: "analyticsadmin.googleapis.com/Property"
33  pattern: "properties/{property}"
34};
35
36// Google Analytics reporting data service.
37service BetaAnalyticsData {
38  option (google.api.default_host) = "analyticsdata.googleapis.com";
39  option (google.api.oauth_scopes) =
40      "https://www.googleapis.com/auth/analytics,"
41      "https://www.googleapis.com/auth/analytics.readonly";
42
43  // Returns a customized report of your Google Analytics event data. Reports
44  // contain statistics derived from data collected by the Google Analytics
45  // tracking code. The data returned from the API is as a table with columns
46  // for the requested dimensions and metrics. Metrics are individual
47  // measurements of user activity on your property, such as active users or
48  // event count. Dimensions break down metrics across some common criteria,
49  // such as country or event name.
50  //
51  // For a guide to constructing requests & understanding responses, see
52  // [Creating a
53  // Report](https://developers.google.com/analytics/devguides/reporting/data/v1/basics).
54  rpc RunReport(RunReportRequest) returns (RunReportResponse) {
55    option (google.api.http) = {
56      post: "/v1beta/{property=properties/*}:runReport"
57      body: "*"
58    };
59  }
60
61  // Returns a customized pivot report of your Google Analytics event data.
62  // Pivot reports are more advanced and expressive formats than regular
63  // reports. In a pivot report, dimensions are only visible if they are
64  // included in a pivot. Multiple pivots can be specified to further dissect
65  // your data.
66  rpc RunPivotReport(RunPivotReportRequest) returns (RunPivotReportResponse) {
67    option (google.api.http) = {
68      post: "/v1beta/{property=properties/*}:runPivotReport"
69      body: "*"
70    };
71  }
72
73  // Returns multiple reports in a batch. All reports must be for the same
74  // GA4 Property.
75  rpc BatchRunReports(BatchRunReportsRequest)
76      returns (BatchRunReportsResponse) {
77    option (google.api.http) = {
78      post: "/v1beta/{property=properties/*}:batchRunReports"
79      body: "*"
80    };
81  }
82
83  // Returns multiple pivot reports in a batch. All reports must be for the same
84  // GA4 Property.
85  rpc BatchRunPivotReports(BatchRunPivotReportsRequest)
86      returns (BatchRunPivotReportsResponse) {
87    option (google.api.http) = {
88      post: "/v1beta/{property=properties/*}:batchRunPivotReports"
89      body: "*"
90    };
91  }
92
93  // Returns metadata for dimensions and metrics available in reporting methods.
94  // Used to explore the dimensions and metrics. In this method, a Google
95  // Analytics GA4 Property Identifier is specified in the request, and
96  // the metadata response includes Custom dimensions and metrics as well as
97  // Universal metadata.
98  //
99  // For example if a custom metric with parameter name `levels_unlocked` is
100  // registered to a property, the Metadata response will contain
101  // `customEvent:levels_unlocked`. Universal metadata are dimensions and
102  // metrics applicable to any property such as `country` and `totalUsers`.
103  rpc GetMetadata(GetMetadataRequest) returns (Metadata) {
104    option (google.api.http) = {
105      get: "/v1beta/{name=properties/*/metadata}"
106    };
107    option (google.api.method_signature) = "name";
108  }
109
110  // Returns a customized report of realtime event data for your property.
111  // Events appear in realtime reports seconds after they have been sent to
112  // the Google Analytics. Realtime reports show events and usage data for the
113  // periods of time ranging from the present moment to 30 minutes ago (up to
114  // 60 minutes for Google Analytics 360 properties).
115  //
116  // For a guide to constructing realtime requests & understanding responses,
117  // see [Creating a Realtime
118  // Report](https://developers.google.com/analytics/devguides/reporting/data/v1/realtime-basics).
119  rpc RunRealtimeReport(RunRealtimeReportRequest)
120      returns (RunRealtimeReportResponse) {
121    option (google.api.http) = {
122      post: "/v1beta/{property=properties/*}:runRealtimeReport"
123      body: "*"
124    };
125  }
126
127  // This compatibility method lists dimensions and metrics that can be added to
128  // a report request and maintain compatibility. This method fails if the
129  // request's dimensions and metrics are incompatible.
130  //
131  // In Google Analytics, reports fail if they request incompatible dimensions
132  // and/or metrics; in that case, you will need to remove dimensions and/or
133  // metrics from the incompatible report until the report is compatible.
134  //
135  // The Realtime and Core reports have different compatibility rules. This
136  // method checks compatibility for Core reports.
137  rpc CheckCompatibility(CheckCompatibilityRequest)
138      returns (CheckCompatibilityResponse) {
139    option (google.api.http) = {
140      post: "/v1beta/{property=properties/*}:checkCompatibility"
141      body: "*"
142    };
143  }
144
145  // Creates an audience export for later retrieval. This method quickly returns
146  // the audience export's resource name and initiates a long running
147  // asynchronous request to form an audience export. To export the users in an
148  // audience export, first create the audience export through this method and
149  // then send the audience resource name to the `QueryAudienceExport` method.
150  //
151  // See [Creating an Audience
152  // Export](https://developers.google.com/analytics/devguides/reporting/data/v1/audience-list-basics)
153  // for an introduction to Audience Exports with examples.
154  //
155  // An audience export is a snapshot of the users currently in the audience at
156  // the time of audience export creation. Creating audience exports for one
157  // audience on different days will return different results as users enter and
158  // exit the audience.
159  //
160  // Audiences in Google Analytics 4 allow you to segment your users in the ways
161  // that are important to your business. To learn more, see
162  // https://support.google.com/analytics/answer/9267572. Audience exports
163  // contain the users in each audience.
164  //
165  // Audience Export APIs have some methods at alpha and other methods at beta
166  // stability. The intention is to advance methods to beta stability after some
167  // feedback and adoption. To give your feedback on this API, complete the
168  // [Google Analytics Audience Export API
169  // Feedback](https://forms.gle/EeA5u5LW6PEggtCEA) form.
170  rpc CreateAudienceExport(CreateAudienceExportRequest)
171      returns (google.longrunning.Operation) {
172    option (google.api.http) = {
173      post: "/v1beta/{parent=properties/*}/audienceExports"
174      body: "audience_export"
175    };
176    option (google.api.method_signature) = "parent,audience_export";
177    option (google.longrunning.operation_info) = {
178      response_type: "AudienceExport"
179      metadata_type: "AudienceExportMetadata"
180    };
181  }
182
183  // Retrieves an audience export of users. After creating an audience, the
184  // users are not immediately available for exporting. First, a request to
185  // `CreateAudienceExport` is necessary to create an audience export of users,
186  // and then second, this method is used to retrieve the users in the audience
187  // export.
188  //
189  // See [Creating an Audience
190  // Export](https://developers.google.com/analytics/devguides/reporting/data/v1/audience-list-basics)
191  // for an introduction to Audience Exports with examples.
192  //
193  // Audiences in Google Analytics 4 allow you to segment your users in the ways
194  // that are important to your business. To learn more, see
195  // https://support.google.com/analytics/answer/9267572.
196  //
197  // Audience Export APIs have some methods at alpha and other methods at beta
198  // stability. The intention is to advance methods to beta stability after some
199  // feedback and adoption. To give your feedback on this API, complete the
200  // [Google Analytics Audience Export API
201  // Feedback](https://forms.gle/EeA5u5LW6PEggtCEA) form.
202  rpc QueryAudienceExport(QueryAudienceExportRequest)
203      returns (QueryAudienceExportResponse) {
204    option (google.api.http) = {
205      post: "/v1beta/{name=properties/*/audienceExports/*}:query"
206      body: "*"
207    };
208    option (google.api.method_signature) = "name";
209  }
210
211  // Gets configuration metadata about a specific audience export. This method
212  // can be used to understand an audience export after it has been created.
213  //
214  // See [Creating an Audience
215  // Export](https://developers.google.com/analytics/devguides/reporting/data/v1/audience-list-basics)
216  // for an introduction to Audience Exports with examples.
217  //
218  // Audience Export APIs have some methods at alpha and other methods at beta
219  // stability. The intention is to advance methods to beta stability after some
220  // feedback and adoption. To give your feedback on this API, complete the
221  // [Google Analytics Audience Export API
222  // Feedback](https://forms.gle/EeA5u5LW6PEggtCEA) form.
223  rpc GetAudienceExport(GetAudienceExportRequest) returns (AudienceExport) {
224    option (google.api.http) = {
225      get: "/v1beta/{name=properties/*/audienceExports/*}"
226    };
227    option (google.api.method_signature) = "name";
228  }
229
230  // Lists all audience exports for a property. This method can be used for you
231  // to find and reuse existing audience exports rather than creating
232  // unnecessary new audience exports. The same audience can have multiple
233  // audience exports that represent the export of users that were in an
234  // audience on different days.
235  //
236  // See [Creating an Audience
237  // Export](https://developers.google.com/analytics/devguides/reporting/data/v1/audience-list-basics)
238  // for an introduction to Audience Exports with examples.
239  //
240  // Audience Export APIs have some methods at alpha and other methods at beta
241  // stability. The intention is to advance methods to beta stability after some
242  // feedback and adoption. To give your feedback on this API, complete the
243  // [Google Analytics Audience Export API
244  // Feedback](https://forms.gle/EeA5u5LW6PEggtCEA) form.
245  rpc ListAudienceExports(ListAudienceExportsRequest)
246      returns (ListAudienceExportsResponse) {
247    option (google.api.http) = {
248      get: "/v1beta/{parent=properties/*}/audienceExports"
249    };
250    option (google.api.method_signature) = "parent";
251  }
252}
253
254// The request for compatibility information for a report's dimensions and
255// metrics. Check compatibility provides a preview of the compatibility of a
256// report; fields shared with the `runReport` request should be the same values
257// as in your `runReport` request.
258message CheckCompatibilityRequest {
259  // A Google Analytics GA4 property identifier whose events are tracked. To
260  // learn more, see [where to find your Property
261  // ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id).
262  // `property` should be the same value as in your `runReport` request.
263  //
264  // Example: properties/1234
265  string property = 1;
266
267  // The dimensions in this report. `dimensions` should be the same value as in
268  // your `runReport` request.
269  repeated Dimension dimensions = 2;
270
271  // The metrics in this report. `metrics` should be the same value as in your
272  // `runReport` request.
273  repeated Metric metrics = 3;
274
275  // The filter clause of dimensions. `dimensionFilter` should be the same value
276  // as in your `runReport` request.
277  FilterExpression dimension_filter = 4;
278
279  // The filter clause of metrics. `metricFilter` should be the same value as in
280  // your `runReport` request
281  FilterExpression metric_filter = 5;
282
283  // Filters the dimensions and metrics in the response to just this
284  // compatibility. Commonly used as `”compatibilityFilter”: “COMPATIBLE”`
285  // to only return compatible dimensions & metrics.
286  Compatibility compatibility_filter = 6;
287}
288
289// The compatibility response with the compatibility of each dimension & metric.
290message CheckCompatibilityResponse {
291  // The compatibility of each dimension.
292  repeated DimensionCompatibility dimension_compatibilities = 1;
293
294  // The compatibility of each metric.
295  repeated MetricCompatibility metric_compatibilities = 2;
296}
297
298// The dimensions, metrics and comparisons currently accepted in reporting
299// methods.
300message Metadata {
301  option (google.api.resource) = {
302    type: "analyticsdata.googleapis.com/Metadata"
303    pattern: "properties/{property}/metadata"
304  };
305
306  // Resource name of this metadata.
307  string name = 3;
308
309  // The dimension descriptions.
310  repeated DimensionMetadata dimensions = 1;
311
312  // The metric descriptions.
313  repeated MetricMetadata metrics = 2;
314}
315
316// The request to generate a report.
317message RunReportRequest {
318  // A Google Analytics GA4 property identifier whose events are tracked.
319  // Specified in the URL path and not the body. To learn more, see [where to
320  // find your Property
321  // ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id).
322  // Within a batch request, this property should either be unspecified or
323  // consistent with the batch-level property.
324  //
325  // Example: properties/1234
326  string property = 1;
327
328  // The dimensions requested and displayed.
329  repeated Dimension dimensions = 2;
330
331  // The metrics requested and displayed.
332  repeated Metric metrics = 3;
333
334  // Date ranges of data to read. If multiple date ranges are requested, each
335  // response row will contain a zero based date range index. If two date
336  // ranges overlap, the event data for the overlapping days is included in the
337  // response rows for both date ranges. In a cohort request, this `dateRanges`
338  // must be unspecified.
339  repeated DateRange date_ranges = 4;
340
341  // Dimension filters let you ask for only specific dimension values in
342  // the report. To learn more, see [Fundamentals of Dimension
343  // Filters](https://developers.google.com/analytics/devguides/reporting/data/v1/basics#dimension_filters)
344  // for examples. Metrics cannot be used in this filter.
345  FilterExpression dimension_filter = 5;
346
347  // The filter clause of metrics. Applied after aggregating the report's rows,
348  // similar to SQL having-clause. Dimensions cannot be used in this filter.
349  FilterExpression metric_filter = 6;
350
351  // The row count of the start row. The first row is counted as row 0.
352  //
353  // When paging, the first request does not specify offset; or equivalently,
354  // sets offset to 0; the first request returns the first `limit` of rows. The
355  // second request sets offset to the `limit` of the first request; the second
356  // request returns the second `limit` of rows.
357  //
358  // To learn more about this pagination parameter, see
359  // [Pagination](https://developers.google.com/analytics/devguides/reporting/data/v1/basics#pagination).
360  int64 offset = 7;
361
362  // The number of rows to return. If unspecified, 10,000 rows are returned. The
363  // API returns a maximum of 250,000 rows per request, no matter how many you
364  // ask for. `limit` must be positive.
365  //
366  // The API can also return fewer rows than the requested `limit`, if there
367  // aren't as many dimension values as the `limit`. For instance, there are
368  // fewer than 300 possible values for the dimension `country`, so when
369  // reporting on only `country`, you can't get more than 300 rows, even if you
370  // set `limit` to a higher value.
371  //
372  // To learn more about this pagination parameter, see
373  // [Pagination](https://developers.google.com/analytics/devguides/reporting/data/v1/basics#pagination).
374  int64 limit = 8;
375
376  // Aggregation of metrics. Aggregated metric values will be shown in rows
377  // where the dimension_values are set to "RESERVED_(MetricAggregation)".
378  repeated MetricAggregation metric_aggregations = 9;
379
380  // Specifies how rows are ordered in the response.
381  repeated OrderBy order_bys = 10;
382
383  // A currency code in ISO4217 format, such as "AED", "USD", "JPY".
384  // If the field is empty, the report uses the property's default currency.
385  string currency_code = 11;
386
387  // Cohort group associated with this request. If there is a cohort group
388  // in the request the 'cohort' dimension must be present.
389  CohortSpec cohort_spec = 12;
390
391  // If false or unspecified, each row with all metrics equal to 0 will not be
392  // returned. If true, these rows will be returned if they are not separately
393  // removed by a filter.
394  //
395  // Regardless of this `keep_empty_rows` setting, only data recorded by the
396  // Google Analytics (GA4) property can be displayed in a report.
397  //
398  // For example if a property never logs a `purchase` event, then a query for
399  // the `eventName` dimension and  `eventCount` metric will not have a row
400  // eventName: "purchase" and eventCount: 0.
401  bool keep_empty_rows = 13;
402
403  // Toggles whether to return the current state of this Analytics Property's
404  // quota. Quota is returned in [PropertyQuota](#PropertyQuota).
405  bool return_property_quota = 14;
406}
407
408// The response report table corresponding to a request.
409message RunReportResponse {
410  // Describes dimension columns. The number of DimensionHeaders and ordering of
411  // DimensionHeaders matches the dimensions present in rows.
412  repeated DimensionHeader dimension_headers = 1;
413
414  // Describes metric columns. The number of MetricHeaders and ordering of
415  // MetricHeaders matches the metrics present in rows.
416  repeated MetricHeader metric_headers = 2;
417
418  // Rows of dimension value combinations and metric values in the report.
419  repeated Row rows = 3;
420
421  // If requested, the totaled values of metrics.
422  repeated Row totals = 4;
423
424  // If requested, the maximum values of metrics.
425  repeated Row maximums = 5;
426
427  // If requested, the minimum values of metrics.
428  repeated Row minimums = 6;
429
430  // The total number of rows in the query result. `rowCount` is independent of
431  // the number of rows returned in the response, the `limit` request
432  // parameter, and the `offset` request parameter. For example if a query
433  // returns 175 rows and includes `limit` of 50 in the API request, the
434  // response will contain `rowCount` of 175 but only 50 rows.
435  //
436  // To learn more about this pagination parameter, see
437  // [Pagination](https://developers.google.com/analytics/devguides/reporting/data/v1/basics#pagination).
438  int32 row_count = 7;
439
440  // Metadata for the report.
441  ResponseMetaData metadata = 8;
442
443  // This Analytics Property's quota state including this request.
444  PropertyQuota property_quota = 9;
445
446  // Identifies what kind of resource this message is. This `kind` is always the
447  // fixed string "analyticsData#runReport". Useful to distinguish between
448  // response types in JSON.
449  string kind = 10;
450}
451
452// The request to generate a pivot report.
453message RunPivotReportRequest {
454  // A Google Analytics GA4 property identifier whose events are tracked.
455  // Specified in the URL path and not the body. To learn more, see [where to
456  // find your Property
457  // ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id).
458  // Within a batch request, this property should either be unspecified or
459  // consistent with the batch-level property.
460  //
461  // Example: properties/1234
462  string property = 1;
463
464  // The dimensions requested. All defined dimensions must be used by one of the
465  // following: dimension_expression, dimension_filter, pivots, order_bys.
466  repeated Dimension dimensions = 2;
467
468  // The metrics requested, at least one metric needs to be specified. All
469  // defined metrics must be used by one of the following: metric_expression,
470  // metric_filter, order_bys.
471  repeated Metric metrics = 3;
472
473  // The date range to retrieve event data for the report. If multiple date
474  // ranges are specified, event data from each date range is used in the
475  // report. A special dimension with field name "dateRange" can be included in
476  // a Pivot's field names; if included, the report compares between date
477  // ranges. In a cohort request, this `dateRanges` must be unspecified.
478  repeated DateRange date_ranges = 4;
479
480  // Describes the visual format of the report's dimensions in columns or rows.
481  // The union of the fieldNames (dimension names) in all pivots must be a
482  // subset of dimension names defined in Dimensions. No two pivots can share a
483  // dimension. A dimension is only visible if it appears in a pivot.
484  repeated Pivot pivots = 5;
485
486  // The filter clause of dimensions. Dimensions must be requested to be used in
487  // this filter. Metrics cannot be used in this filter.
488  FilterExpression dimension_filter = 6;
489
490  // The filter clause of metrics. Applied at post aggregation phase, similar to
491  // SQL having-clause. Metrics must be requested to be used in this filter.
492  // Dimensions cannot be used in this filter.
493  FilterExpression metric_filter = 7;
494
495  // A currency code in ISO4217 format, such as "AED", "USD", "JPY".
496  // If the field is empty, the report uses the property's default currency.
497  string currency_code = 8;
498
499  // Cohort group associated with this request. If there is a cohort group
500  // in the request the 'cohort' dimension must be present.
501  CohortSpec cohort_spec = 9;
502
503  // If false or unspecified, each row with all metrics equal to 0 will not be
504  // returned. If true, these rows will be returned if they are not separately
505  // removed by a filter.
506  //
507  // Regardless of this `keep_empty_rows` setting, only data recorded by the
508  // Google Analytics (GA4) property can be displayed in a report.
509  //
510  // For example if a property never logs a `purchase` event, then a query for
511  // the `eventName` dimension and  `eventCount` metric will not have a row
512  // eventName: "purchase" and eventCount: 0.
513  bool keep_empty_rows = 10;
514
515  // Toggles whether to return the current state of this Analytics Property's
516  // quota. Quota is returned in [PropertyQuota](#PropertyQuota).
517  bool return_property_quota = 11;
518}
519
520// The response pivot report table corresponding to a pivot request.
521message RunPivotReportResponse {
522  // Summarizes the columns and rows created by a pivot. Each pivot in the
523  // request produces one header in the response. If we have a request like
524  // this:
525  //
526  //     "pivots": [{
527  //       "fieldNames": ["country",
528  //         "city"]
529  //     },
530  //     {
531  //       "fieldNames": "eventName"
532  //     }]
533  //
534  // We will have the following `pivotHeaders` in the response:
535  //
536  //     "pivotHeaders" : [{
537  //       "dimensionHeaders": [{
538  //         "dimensionValues": [
539  //            { "value": "United Kingdom" },
540  //            { "value": "London" }
541  //          ]
542  //       },
543  //       {
544  //         "dimensionValues": [
545  //         { "value": "Japan" },
546  //         { "value": "Osaka" }
547  //         ]
548  //       }]
549  //     },
550  //     {
551  //       "dimensionHeaders": [{
552  //         "dimensionValues": [{ "value": "session_start" }]
553  //       },
554  //       {
555  //         "dimensionValues": [{ "value": "scroll" }]
556  //       }]
557  //     }]
558  repeated PivotHeader pivot_headers = 1;
559
560  // Describes dimension columns. The number of DimensionHeaders and ordering of
561  // DimensionHeaders matches the dimensions present in rows.
562  repeated DimensionHeader dimension_headers = 2;
563
564  // Describes metric columns. The number of MetricHeaders and ordering of
565  // MetricHeaders matches the metrics present in rows.
566  repeated MetricHeader metric_headers = 3;
567
568  // Rows of dimension value combinations and metric values in the report.
569  repeated Row rows = 4;
570
571  // Aggregation of metric values. Can be totals, minimums, or maximums. The
572  // returned aggregations are controlled by the metric_aggregations in the
573  // pivot. The type of aggregation returned in each row is shown by the
574  // dimension_values which are set to "RESERVED_<MetricAggregation>".
575  repeated Row aggregates = 5;
576
577  // Metadata for the report.
578  ResponseMetaData metadata = 6;
579
580  // This Analytics Property's quota state including this request.
581  PropertyQuota property_quota = 7;
582
583  // Identifies what kind of resource this message is. This `kind` is always the
584  // fixed string "analyticsData#runPivotReport". Useful to distinguish between
585  // response types in JSON.
586  string kind = 8;
587}
588
589// The batch request containing multiple report requests.
590message BatchRunReportsRequest {
591  // A Google Analytics GA4 property identifier whose events are tracked.
592  // Specified in the URL path and not the body. To learn more, see [where to
593  // find your Property
594  // ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id).
595  // This property must be specified for the batch. The property within
596  // RunReportRequest may either be unspecified or consistent with this
597  // property.
598  //
599  // Example: properties/1234
600  string property = 1;
601
602  // Individual requests. Each request has a separate report response. Each
603  // batch request is allowed up to 5 requests.
604  repeated RunReportRequest requests = 2;
605}
606
607// The batch response containing multiple reports.
608message BatchRunReportsResponse {
609  // Individual responses. Each response has a separate report request.
610  repeated RunReportResponse reports = 1;
611
612  // Identifies what kind of resource this message is. This `kind` is always the
613  // fixed string "analyticsData#batchRunReports". Useful to distinguish between
614  // response types in JSON.
615  string kind = 2;
616}
617
618// The batch request containing multiple pivot report requests.
619message BatchRunPivotReportsRequest {
620  // A Google Analytics GA4 property identifier whose events are tracked.
621  // Specified in the URL path and not the body. To learn more, see [where to
622  // find your Property
623  // ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id).
624  // This property must be specified for the batch. The property within
625  // RunPivotReportRequest may either be unspecified or consistent with this
626  // property.
627  //
628  // Example: properties/1234
629  string property = 1;
630
631  // Individual requests. Each request has a separate pivot report response.
632  // Each batch request is allowed up to 5 requests.
633  repeated RunPivotReportRequest requests = 2;
634}
635
636// The batch response containing multiple pivot reports.
637message BatchRunPivotReportsResponse {
638  // Individual responses. Each response has a separate pivot report request.
639  repeated RunPivotReportResponse pivot_reports = 1;
640
641  // Identifies what kind of resource this message is. This `kind` is always the
642  // fixed string "analyticsData#batchRunPivotReports". Useful to distinguish
643  // between response types in JSON.
644  string kind = 2;
645}
646
647// Request for a property's dimension and metric metadata.
648message GetMetadataRequest {
649  // Required. The resource name of the metadata to retrieve. This name field is
650  // specified in the URL path and not URL parameters. Property is a numeric
651  // Google Analytics GA4 Property identifier. To learn more, see [where to find
652  // your Property
653  // ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id).
654  //
655  // Example: properties/1234/metadata
656  //
657  // Set the Property ID to 0 for dimensions and metrics common to all
658  // properties. In this special mode, this method will not return custom
659  // dimensions and metrics.
660  string name = 1 [
661    (google.api.field_behavior) = REQUIRED,
662    (google.api.resource_reference) = {
663      type: "analyticsdata.googleapis.com/Metadata"
664    }
665  ];
666}
667
668// The request to generate a realtime report.
669message RunRealtimeReportRequest {
670  // A Google Analytics GA4 property identifier whose events are tracked.
671  // Specified in the URL path and not the body. To learn more, see [where to
672  // find your Property
673  // ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id).
674  //
675  // Example: properties/1234
676  string property = 1;
677
678  // The dimensions requested and displayed.
679  repeated Dimension dimensions = 2;
680
681  // The metrics requested and displayed.
682  repeated Metric metrics = 3;
683
684  // The filter clause of dimensions. Metrics cannot be used in this filter.
685  FilterExpression dimension_filter = 4;
686
687  // The filter clause of metrics. Applied at post aggregation phase, similar to
688  // SQL having-clause. Dimensions cannot be used in this filter.
689  FilterExpression metric_filter = 5;
690
691  // The number of rows to return. If unspecified, 10,000 rows are returned. The
692  // API returns a maximum of 250,000 rows per request, no matter how many you
693  // ask for. `limit` must be positive.
694  //
695  // The API can also return fewer rows than the requested `limit`, if there
696  // aren't as many dimension values as the `limit`. For instance, there are
697  // fewer than 300 possible values for the dimension `country`, so when
698  // reporting on only `country`, you can't get more than 300 rows, even if you
699  // set `limit` to a higher value.
700  int64 limit = 6;
701
702  // Aggregation of metrics. Aggregated metric values will be shown in rows
703  // where the dimension_values are set to "RESERVED_(MetricAggregation)".
704  repeated MetricAggregation metric_aggregations = 7;
705
706  // Specifies how rows are ordered in the response.
707  repeated OrderBy order_bys = 8;
708
709  // Toggles whether to return the current state of this Analytics Property's
710  // Realtime quota. Quota is returned in [PropertyQuota](#PropertyQuota).
711  bool return_property_quota = 9;
712
713  // The minute ranges of event data to read. If unspecified, one minute range
714  // for the last 30 minutes will be used. If multiple minute ranges are
715  // requested, each response row will contain a zero based minute range index.
716  // If two minute ranges overlap, the event data for the overlapping minutes is
717  // included in the response rows for both minute ranges.
718  repeated MinuteRange minute_ranges = 10;
719}
720
721// The response realtime report table corresponding to a request.
722message RunRealtimeReportResponse {
723  // Describes dimension columns. The number of DimensionHeaders and ordering of
724  // DimensionHeaders matches the dimensions present in rows.
725  repeated DimensionHeader dimension_headers = 1;
726
727  // Describes metric columns. The number of MetricHeaders and ordering of
728  // MetricHeaders matches the metrics present in rows.
729  repeated MetricHeader metric_headers = 2;
730
731  // Rows of dimension value combinations and metric values in the report.
732  repeated Row rows = 3;
733
734  // If requested, the totaled values of metrics.
735  repeated Row totals = 4;
736
737  // If requested, the maximum values of metrics.
738  repeated Row maximums = 5;
739
740  // If requested, the minimum values of metrics.
741  repeated Row minimums = 6;
742
743  // The total number of rows in the query result. `rowCount` is independent of
744  // the number of rows returned in the response and the `limit` request
745  // parameter. For example if a query returns 175 rows and includes `limit`
746  // of 50 in the API request, the response will contain `rowCount` of 175 but
747  // only 50 rows.
748  int32 row_count = 7;
749
750  // This Analytics Property's Realtime quota state including this request.
751  PropertyQuota property_quota = 8;
752
753  // Identifies what kind of resource this message is. This `kind` is always the
754  // fixed string "analyticsData#runRealtimeReport". Useful to distinguish
755  // between response types in JSON.
756  string kind = 9;
757}
758
759// A request to retrieve configuration metadata about a specific audience
760// export.
761message GetAudienceExportRequest {
762  // Required. The audience export resource name.
763  // Format: `properties/{property}/audienceExports/{audience_export}`
764  string name = 1 [
765    (google.api.field_behavior) = REQUIRED,
766    (google.api.resource_reference) = {
767      type: "analyticsdata.googleapis.com/AudienceExport"
768    }
769  ];
770}
771
772// A request to list all audience exports for a property.
773message ListAudienceExportsRequest {
774  // Required. All audience exports for this property will be listed in the
775  // response. Format: `properties/{property}`
776  string parent = 1 [
777    (google.api.field_behavior) = REQUIRED,
778    (google.api.resource_reference) = {
779      child_type: "analyticsdata.googleapis.com/AudienceExport"
780    }
781  ];
782
783  // Optional. The maximum number of audience exports to return. The service may
784  // return fewer than this value. If unspecified, at most 200 audience exports
785  // will be returned. The maximum value is 1000 (higher values will be coerced
786  // to the maximum).
787  int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];
788
789  // Optional. A page token, received from a previous `ListAudienceExports`
790  // call. Provide this to retrieve the subsequent page.
791  //
792  // When paginating, all other parameters provided to `ListAudienceExports`
793  // must match the call that provided the page token.
794  string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
795}
796
797// A list of all audience exports for a property.
798message ListAudienceExportsResponse {
799  // Each audience export for a property.
800  repeated AudienceExport audience_exports = 1;
801
802  // A token, which can be sent as `page_token` to retrieve the next page.
803  // If this field is omitted, there are no subsequent pages.
804  optional string next_page_token = 2;
805}
806
807// A request to create a new audience export.
808message CreateAudienceExportRequest {
809  // Required. The parent resource where this audience export will be created.
810  // Format: `properties/{property}`
811  string parent = 1 [
812    (google.api.field_behavior) = REQUIRED,
813    (google.api.resource_reference) = {
814      child_type: "analyticsdata.googleapis.com/AudienceExport"
815    }
816  ];
817
818  // Required. The audience export to create.
819  AudienceExport audience_export = 2 [(google.api.field_behavior) = REQUIRED];
820}
821
822// An audience export is a list of users in an audience at the time of the
823// list's creation. One audience may have multiple audience exports created for
824// different days.
825message AudienceExport {
826  option (google.api.resource) = {
827    type: "analyticsdata.googleapis.com/AudienceExport"
828    pattern: "properties/{property}/audienceExports/{audience_export}"
829    plural: "audienceExports"
830    singular: "audienceExport"
831  };
832
833  // The AudienceExport currently exists in this state.
834  enum State {
835    // Unspecified state will never be used.
836    STATE_UNSPECIFIED = 0;
837
838    // The AudienceExport is currently creating and will be available in the
839    // future. Creating occurs immediately after the CreateAudienceExport call.
840    CREATING = 1;
841
842    // The AudienceExport is fully created and ready for querying. An
843    // AudienceExport is updated to active asynchronously from a request; this
844    // occurs some time (for example 15 minutes) after the initial create call.
845    ACTIVE = 2;
846
847    // The AudienceExport failed to be created. It is possible that
848    // re-requesting this audience export will succeed.
849    FAILED = 3;
850  }
851
852  // Output only. Identifier. The audience export resource name assigned during
853  // creation. This resource name identifies this `AudienceExport`.
854  //
855  // Format: `properties/{property}/audienceExports/{audience_export}`
856  string name = 1 [
857    (google.api.field_behavior) = IDENTIFIER,
858    (google.api.field_behavior) = OUTPUT_ONLY
859  ];
860
861  // Required. The audience resource name. This resource name identifies the
862  // audience being listed and is shared between the Analytics Data & Admin
863  // APIs.
864  //
865  // Format: `properties/{property}/audiences/{audience}`
866  string audience = 2 [(google.api.field_behavior) = REQUIRED];
867
868  // Output only. The descriptive display name for this audience. For example,
869  // "Purchasers".
870  string audience_display_name = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
871
872  // Required. The dimensions requested and displayed in the query response.
873  repeated AudienceDimension dimensions = 4
874      [(google.api.field_behavior) = REQUIRED];
875
876  // Output only. The current state for this AudienceExport.
877  optional State state = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
878
879  // Output only. The time when CreateAudienceExport was called and the
880  // AudienceExport began the `CREATING` state.
881  optional google.protobuf.Timestamp begin_creating_time = 6
882      [(google.api.field_behavior) = OUTPUT_ONLY];
883
884  // Output only. The total quota tokens charged during creation of the
885  // AudienceExport. Because this token count is based on activity from the
886  // `CREATING` state, this tokens charged will be fixed once an AudienceExport
887  // enters the `ACTIVE` or `FAILED` states.
888  int32 creation_quota_tokens_charged = 7
889      [(google.api.field_behavior) = OUTPUT_ONLY];
890
891  // Output only. The total number of rows in the AudienceExport result.
892  optional int32 row_count = 8 [(google.api.field_behavior) = OUTPUT_ONLY];
893
894  // Output only. Error message is populated when an audience export fails
895  // during creation. A common reason for such a failure is quota exhaustion.
896  optional string error_message = 9 [(google.api.field_behavior) = OUTPUT_ONLY];
897
898  // Output only. The percentage completed for this audience export ranging
899  // between 0 to 100.
900  optional double percentage_completed = 10
901      [(google.api.field_behavior) = OUTPUT_ONLY];
902}
903
904// This metadata is currently blank.
905message AudienceExportMetadata {}
906
907// A request to list users in an audience export.
908message QueryAudienceExportRequest {
909  // Required. The name of the audience export to retrieve users from.
910  // Format: `properties/{property}/audienceExports/{audience_export}`
911  string name = 1 [(google.api.field_behavior) = REQUIRED];
912
913  // Optional. The row count of the start row. The first row is counted as row
914  // 0.
915  //
916  // When paging, the first request does not specify offset; or equivalently,
917  // sets offset to 0; the first request returns the first `limit` of rows. The
918  // second request sets offset to the `limit` of the first request; the second
919  // request returns the second `limit` of rows.
920  //
921  // To learn more about this pagination parameter, see
922  // [Pagination](https://developers.google.com/analytics/devguides/reporting/data/v1/basics#pagination).
923  int64 offset = 2 [(google.api.field_behavior) = OPTIONAL];
924
925  // Optional. The number of rows to return. If unspecified, 10,000 rows are
926  // returned. The API returns a maximum of 250,000 rows per request, no matter
927  // how many you ask for. `limit` must be positive.
928  //
929  // The API can also return fewer rows than the requested `limit`, if there
930  // aren't as many dimension values as the `limit`.
931  //
932  // To learn more about this pagination parameter, see
933  // [Pagination](https://developers.google.com/analytics/devguides/reporting/data/v1/basics#pagination).
934  int64 limit = 3 [(google.api.field_behavior) = OPTIONAL];
935}
936
937// A list of users in an audience export.
938message QueryAudienceExportResponse {
939  // Configuration data about AudienceExport being queried. Returned to help
940  // interpret the audience rows in this response. For example, the dimensions
941  // in this AudienceExport correspond to the columns in the AudienceRows.
942  optional AudienceExport audience_export = 1;
943
944  // Rows for each user in an audience export. The number of rows in this
945  // response will be less than or equal to request's page size.
946  repeated AudienceRow audience_rows = 2;
947
948  // The total number of rows in the AudienceExport result. `rowCount` is
949  // independent of the number of rows returned in the response, the `limit`
950  // request parameter, and the `offset` request parameter. For example if a
951  // query returns 175 rows and includes `limit` of 50 in the API request, the
952  // response will contain `rowCount` of 175 but only 50 rows.
953  //
954  // To learn more about this pagination parameter, see
955  // [Pagination](https://developers.google.com/analytics/devguides/reporting/data/v1/basics#pagination).
956  optional int32 row_count = 3;
957}
958
959// Dimension value attributes for the audience user row.
960message AudienceRow {
961  // Each dimension value attribute for an audience user. One dimension value
962  // will be added for each dimension column requested.
963  repeated AudienceDimensionValue dimension_values = 1;
964}
965
966// An audience dimension is a user attribute. Specific user attributed are
967// requested and then later returned in the `QueryAudienceExportResponse`.
968message AudienceDimension {
969  // Optional. The API name of the dimension. See the [API
970  // Dimensions](https://developers.google.com/analytics/devguides/reporting/data/v1/audience-list-api-schema#dimensions)
971  // for the list of dimension names.
972  string dimension_name = 1 [(google.api.field_behavior) = OPTIONAL];
973}
974
975// The value of a dimension.
976message AudienceDimensionValue {
977  // One kind of dimension value.
978  oneof one_value {
979    // Value as a string if the dimension type is a string.
980    string value = 1;
981  }
982}
983