xref: /aosp_15_r20/external/googleapis/google/analytics/data/v1beta/data.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
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
19option go_package = "google.golang.org/genproto/googleapis/analytics/data/v1beta;data";
20option java_multiple_files = true;
21option java_outer_classname = "ReportingApiProto";
22option java_package = "com.google.analytics.data.v1beta";
23
24// A contiguous set of days: `startDate`, `startDate + 1`, ..., `endDate`.
25// Requests are allowed up to 4 date ranges.
26message DateRange {
27  // The inclusive start date for the query in the format `YYYY-MM-DD`. Cannot
28  // be after `end_date`. The format `NdaysAgo`, `yesterday`, or `today` is also
29  // accepted, and in that case, the date is inferred based on the property's
30  // reporting time zone.
31  string start_date = 1;
32
33  // The inclusive end date for the query in the format `YYYY-MM-DD`. Cannot
34  // be before `start_date`. The format `NdaysAgo`, `yesterday`, or `today` is
35  // also accepted, and in that case, the date is inferred based on the
36  // property's reporting time zone.
37  string end_date = 2;
38
39  // Assigns a name to this date range. The dimension `dateRange` is valued to
40  // this name in a report response. If set, cannot begin with `date_range_` or
41  // `RESERVED_`. If not set, date ranges are named by their zero based index in
42  // the request: `date_range_0`, `date_range_1`, etc.
43  string name = 3;
44}
45
46// A contiguous set of minutes: `startMinutesAgo`, `startMinutesAgo + 1`, ...,
47// `endMinutesAgo`. Requests are allowed up to 2 minute ranges.
48message MinuteRange {
49  // The inclusive start minute for the query as a number of minutes before now.
50  // For example, `"startMinutesAgo": 29` specifies the report should include
51  // event data from 29 minutes ago and after. Cannot be after `endMinutesAgo`.
52  //
53  // If unspecified, `startMinutesAgo` is defaulted to 29. Standard Analytics
54  // properties can request up to the last 30 minutes of event data
55  // (`startMinutesAgo <= 29`), and 360 Analytics properties can request up to
56  // the last 60 minutes of event data (`startMinutesAgo <= 59`).
57  optional int32 start_minutes_ago = 1;
58
59  // The inclusive end minute for the query as a number of minutes before now.
60  // Cannot be before `startMinutesAgo`. For example, `"endMinutesAgo": 15`
61  // specifies the report should include event data from prior to 15 minutes
62  // ago.
63  //
64  // If unspecified, `endMinutesAgo` is defaulted to 0. Standard Analytics
65  // properties can request any minute in the last 30 minutes of event data
66  // (`endMinutesAgo <= 29`), and 360 Analytics properties can request any
67  // minute in the last 60 minutes of event data (`endMinutesAgo <= 59`).
68  optional int32 end_minutes_ago = 2;
69
70  // Assigns a name to this minute range. The dimension `dateRange` is valued to
71  // this name in a report response. If set, cannot begin with `date_range_` or
72  // `RESERVED_`. If not set, minute ranges are named by their zero based index
73  // in the request: `date_range_0`, `date_range_1`, etc.
74  string name = 3;
75}
76
77// Dimensions are attributes of your data. For example, the dimension city
78// indicates the city from which an event originates. Dimension values in report
79// responses are strings; for example, the city could be "Paris" or "New York".
80// Requests are allowed up to 9 dimensions.
81message Dimension {
82  // The name of the dimension. See the [API
83  // Dimensions](https://developers.google.com/analytics/devguides/reporting/data/v1/api-schema#dimensions)
84  // for the list of dimension names supported by core reporting methods such
85  // as `runReport` and `batchRunReports`. See
86  // [Realtime
87  // Dimensions](https://developers.google.com/analytics/devguides/reporting/data/v1/realtime-api-schema#dimensions)
88  // for the list of dimension names supported by the `runRealtimeReport`
89  // method. See
90  // [Funnel
91  // Dimensions](https://developers.google.com/analytics/devguides/reporting/data/v1/exploration-api-schema#dimensions)
92  // for the list of dimension names supported by the `runFunnelReport`
93  // method.
94  //
95  // If `dimensionExpression` is specified, `name` can be any string that you
96  // would like within the allowed character set. For example if a
97  // `dimensionExpression` concatenates `country` and `city`, you could call
98  // that dimension `countryAndCity`. Dimension names that you choose must match
99  // the regular expression `^[a-zA-Z0-9_]$`.
100  //
101  // Dimensions are referenced by `name` in `dimensionFilter`, `orderBys`,
102  // `dimensionExpression`, and `pivots`.
103  string name = 1;
104
105  // One dimension can be the result of an expression of multiple dimensions.
106  // For example, dimension "country, city": concatenate(country, ", ", city).
107  DimensionExpression dimension_expression = 2;
108}
109
110// Used to express a dimension which is the result of a formula of multiple
111// dimensions. Example usages:
112// 1) lower_case(dimension)
113// 2) concatenate(dimension1, symbol, dimension2).
114message DimensionExpression {
115  // Used to convert a dimension value to a single case.
116  message CaseExpression {
117    // Name of a dimension. The name must refer back to a name in dimensions
118    // field of the request.
119    string dimension_name = 1;
120  }
121
122  // Used to combine dimension values to a single dimension.
123  message ConcatenateExpression {
124    // Names of dimensions. The names must refer back to names in the dimensions
125    // field of the request.
126    repeated string dimension_names = 1;
127
128    // The delimiter placed between dimension names.
129    //
130    // Delimiters are often single characters such as "|" or "," but can be
131    // longer strings. If a dimension value contains the delimiter, both will be
132    // present in response with no distinction. For example if dimension 1 value
133    // = "US,FR", dimension 2 value = "JP", and delimiter = ",", then the
134    // response will contain "US,FR,JP".
135    string delimiter = 2;
136  }
137
138  // Specify one type of dimension expression for `DimensionExpression`.
139  oneof one_expression {
140    // Used to convert a dimension value to lower case.
141    CaseExpression lower_case = 4;
142
143    // Used to convert a dimension value to upper case.
144    CaseExpression upper_case = 5;
145
146    // Used to combine dimension values to a single dimension.
147    // For example, dimension "country, city": concatenate(country, ", ", city).
148    ConcatenateExpression concatenate = 6;
149  }
150}
151
152// The quantitative measurements of a report. For example, the metric
153// `eventCount` is the total number of events. Requests are allowed up to 10
154// metrics.
155message Metric {
156  // The name of the metric. See the [API
157  // Metrics](https://developers.google.com/analytics/devguides/reporting/data/v1/api-schema#metrics)
158  // for the list of metric names supported by core reporting methods such
159  // as `runReport` and `batchRunReports`. See
160  // [Realtime
161  // Metrics](https://developers.google.com/analytics/devguides/reporting/data/v1/realtime-api-schema#metrics)
162  // for the list of metric names supported by the `runRealtimeReport`
163  // method. See
164  // [Funnel
165  // Metrics](https://developers.google.com/analytics/devguides/reporting/data/v1/exploration-api-schema#metrics)
166  // for the list of metric names supported by the `runFunnelReport`
167  // method.
168  //
169  // If `expression` is specified, `name` can be any string that you would like
170  // within the allowed character set. For example if `expression` is
171  // `screenPageViews/sessions`, you could call that metric's name =
172  // `viewsPerSession`. Metric names that you choose must match the regular
173  // expression `^[a-zA-Z0-9_]$`.
174  //
175  // Metrics are referenced by `name` in `metricFilter`, `orderBys`, and metric
176  // `expression`.
177  string name = 1;
178
179  // A mathematical expression for derived metrics. For example, the metric
180  // Event count per user is `eventCount/totalUsers`.
181  string expression = 2;
182
183  // Indicates if a metric is invisible in the report response. If a metric is
184  // invisible, the metric will not produce a column in the response, but can be
185  // used in `metricFilter`, `orderBys`, or a metric `expression`.
186  bool invisible = 3;
187}
188
189// To express dimension or metric filters. The fields in the same
190// FilterExpression need to be either all dimensions or all metrics.
191message FilterExpression {
192  // Specify one type of filter expression for `FilterExpression`.
193  oneof expr {
194    // The FilterExpressions in and_group have an AND relationship.
195    FilterExpressionList and_group = 1;
196
197    // The FilterExpressions in or_group have an OR relationship.
198    FilterExpressionList or_group = 2;
199
200    // The FilterExpression is NOT of not_expression.
201    FilterExpression not_expression = 3;
202
203    // A primitive filter. In the same FilterExpression, all of the filter's
204    // field names need to be either all dimensions or all metrics.
205    Filter filter = 4;
206  }
207}
208
209// A list of filter expressions.
210message FilterExpressionList {
211  // A list of filter expressions.
212  repeated FilterExpression expressions = 1;
213}
214
215// An expression to filter dimension or metric values.
216message Filter {
217  // The filter for string
218  message StringFilter {
219    // The match type of a string filter
220    enum MatchType {
221      // Unspecified
222      MATCH_TYPE_UNSPECIFIED = 0;
223
224      // Exact match of the string value.
225      EXACT = 1;
226
227      // Begins with the string value.
228      BEGINS_WITH = 2;
229
230      // Ends with the string value.
231      ENDS_WITH = 3;
232
233      // Contains the string value.
234      CONTAINS = 4;
235
236      // Full match for the regular expression with the string value.
237      FULL_REGEXP = 5;
238
239      // Partial match for the regular expression with the string value.
240      PARTIAL_REGEXP = 6;
241    }
242
243    // The match type for this filter.
244    MatchType match_type = 1;
245
246    // The string value used for the matching.
247    string value = 2;
248
249    // If true, the string value is case sensitive.
250    bool case_sensitive = 3;
251  }
252
253  // The result needs to be in a list of string values.
254  message InListFilter {
255    // The list of string values.
256    // Must be non-empty.
257    repeated string values = 1;
258
259    // If true, the string value is case sensitive.
260    bool case_sensitive = 2;
261  }
262
263  // Filters for numeric or date values.
264  message NumericFilter {
265    // The operation applied to a numeric filter
266    enum Operation {
267      // Unspecified.
268      OPERATION_UNSPECIFIED = 0;
269
270      // Equal
271      EQUAL = 1;
272
273      // Less than
274      LESS_THAN = 2;
275
276      // Less than or equal
277      LESS_THAN_OR_EQUAL = 3;
278
279      // Greater than
280      GREATER_THAN = 4;
281
282      // Greater than or equal
283      GREATER_THAN_OR_EQUAL = 5;
284    }
285
286    // The operation type for this filter.
287    Operation operation = 1;
288
289    // A numeric value or a date value.
290    NumericValue value = 2;
291  }
292
293  // To express that the result needs to be between two numbers (inclusive).
294  message BetweenFilter {
295    // Begins with this number.
296    NumericValue from_value = 1;
297
298    // Ends with this number.
299    NumericValue to_value = 2;
300  }
301
302  // The dimension name or metric name.
303  //
304  // In most methods, dimensions & metrics can be used for the first time in
305  // this field. However in a RunPivotReportRequest, this field must be
306  // additionally specified by name in the RunPivotReportRequest's dimensions or
307  // metrics.
308  string field_name = 1;
309
310  // Specify one type of filter for `Filter`.
311  oneof one_filter {
312    // Strings related filter.
313    StringFilter string_filter = 3;
314
315    // A filter for in list values.
316    InListFilter in_list_filter = 4;
317
318    // A filter for numeric or date values.
319    NumericFilter numeric_filter = 5;
320
321    // A filter for two values.
322    BetweenFilter between_filter = 6;
323  }
324}
325
326// Order bys define how rows will be sorted in the response. For example,
327// ordering rows by descending event count is one ordering, and ordering rows by
328// the event name string is a different ordering.
329message OrderBy {
330  // Sorts by metric values.
331  message MetricOrderBy {
332    // A metric name in the request to order by.
333    string metric_name = 1;
334  }
335
336  // Sorts by dimension values.
337  message DimensionOrderBy {
338    // Rule to order the string dimension values by.
339    enum OrderType {
340      // Unspecified.
341      ORDER_TYPE_UNSPECIFIED = 0;
342
343      // Alphanumeric sort by Unicode code point. For example, "2" < "A" < "X" <
344      // "b" < "z".
345      ALPHANUMERIC = 1;
346
347      // Case insensitive alphanumeric sort by lower case Unicode code point.
348      // For example, "2" < "A" < "b" < "X" < "z".
349      CASE_INSENSITIVE_ALPHANUMERIC = 2;
350
351      // Dimension values are converted to numbers before sorting. For example
352      // in NUMERIC sort, "25" < "100", and in `ALPHANUMERIC` sort, "100" <
353      // "25". Non-numeric dimension values all have equal ordering value below
354      // all numeric values.
355      NUMERIC = 3;
356    }
357
358    // A dimension name in the request to order by.
359    string dimension_name = 1;
360
361    // Controls the rule for dimension value ordering.
362    OrderType order_type = 2;
363  }
364
365  // Sorts by a pivot column group.
366  message PivotOrderBy {
367    // A pair of dimension names and values. Rows with this dimension pivot pair
368    // are ordered by the metric's value.
369    //
370    // For example if pivots = {{"browser", "Chrome"}} and
371    // metric_name = "Sessions",
372    // then the rows will be sorted based on Sessions in Chrome.
373    //
374    //     ---------|----------|----------------|----------|----------------
375    //              |  Chrome  |    Chrome      |  Safari  |     Safari
376    //     ---------|----------|----------------|----------|----------------
377    //      Country | Sessions | Pages/Sessions | Sessions | Pages/Sessions
378    //     ---------|----------|----------------|----------|----------------
379    //         US   |    2     |       2        |     3    |        1
380    //     ---------|----------|----------------|----------|----------------
381    //       Canada |    3     |       1        |     4    |        1
382    //     ---------|----------|----------------|----------|----------------
383    message PivotSelection {
384      // Must be a dimension name from the request.
385      string dimension_name = 1;
386
387      // Order by only when the named dimension is this value.
388      string dimension_value = 2;
389    }
390
391    // In the response to order by, order rows by this column. Must be a metric
392    // name from the request.
393    string metric_name = 1;
394
395    // Used to select a dimension name and value pivot. If multiple pivot
396    // selections are given, the sort occurs on rows where all pivot selection
397    // dimension name and value pairs match the row's dimension name and value
398    // pair.
399    repeated PivotSelection pivot_selections = 2;
400  }
401
402  // Specify one type of order by for `OrderBy`.
403  oneof one_order_by {
404    // Sorts results by a metric's values.
405    MetricOrderBy metric = 1;
406
407    // Sorts results by a dimension's values.
408    DimensionOrderBy dimension = 2;
409
410    // Sorts results by a metric's values within a pivot column group.
411    PivotOrderBy pivot = 3;
412  }
413
414  // If true, sorts by descending order.
415  bool desc = 4;
416}
417
418// Describes the visible dimension columns and rows in the report response.
419message Pivot {
420  // Dimension names for visible columns in the report response. Including
421  // "dateRange" produces a date range column; for each row in the response,
422  // dimension values in the date range column will indicate the corresponding
423  // date range from the request.
424  repeated string field_names = 1;
425
426  // Specifies how dimensions are ordered in the pivot. In the first Pivot, the
427  // OrderBys determine Row and PivotDimensionHeader ordering; in subsequent
428  // Pivots, the OrderBys determine only PivotDimensionHeader ordering.
429  // Dimensions specified in these OrderBys must be a subset of
430  // Pivot.field_names.
431  repeated OrderBy order_bys = 2;
432
433  // The row count of the start row. The first row is counted as row 0.
434  int64 offset = 3;
435
436  // The number of unique combinations of dimension values to return in this
437  // pivot. The `limit` parameter is required. A `limit` of 10,000 is common for
438  // single pivot requests.
439  //
440  // The product of the `limit` for each `pivot` in a `RunPivotReportRequest`
441  // must not exceed 250,000. For example, a two pivot request with `limit:
442  // 1000` in each pivot will fail because the product is `1,000,000`.
443  int64 limit = 4;
444
445  // Aggregate the metrics by dimensions in this pivot using the specified
446  // metric_aggregations.
447  repeated MetricAggregation metric_aggregations = 5;
448}
449
450// The specification of cohorts for a cohort report.
451//
452// Cohort reports create a time series of user retention for the cohort. For
453// example, you could select the cohort of users that were acquired in the first
454// week of September and follow that cohort for the next six weeks. Selecting
455// the users acquired in the first week of September cohort is specified in the
456// `cohort` object. Following that cohort for the next six weeks is specified in
457// the `cohortsRange` object.
458//
459// For examples, see [Cohort Report
460// Examples](https://developers.google.com/analytics/devguides/reporting/data/v1/advanced#cohort_report_examples).
461//
462// The report response could show a weekly time series where say your app has
463// retained 60% of this cohort after three weeks and 25% of this cohort after
464// six weeks. These two percentages can be calculated by the metric
465// `cohortActiveUsers/cohortTotalUsers` and will be separate rows in the report.
466message CohortSpec {
467  // Defines the selection criteria to group users into cohorts.
468  //
469  // Most cohort reports define only a single cohort. If multiple cohorts are
470  // specified, each cohort can be recognized in the report by their name.
471  repeated Cohort cohorts = 1;
472
473  // Cohort reports follow cohorts over an extended reporting date range. This
474  // range specifies an offset duration to follow the cohorts over.
475  CohortsRange cohorts_range = 2;
476
477  // Optional settings for a cohort report.
478  CohortReportSettings cohort_report_settings = 3;
479}
480
481// Defines a cohort selection criteria. A cohort is a group of users who share
482// a common characteristic. For example, users with the same `firstSessionDate`
483// belong to the same cohort.
484message Cohort {
485  // Assigns a name to this cohort. The dimension `cohort` is valued to this
486  // name in a report response. If set, cannot begin with `cohort_` or
487  // `RESERVED_`. If not set, cohorts are named by their zero based index
488  // `cohort_0`, `cohort_1`, etc.
489  string name = 1;
490
491  // Dimension used by the cohort. Required and only supports
492  // `firstSessionDate`.
493  string dimension = 2;
494
495  // The cohort selects users whose first touch date is between start date and
496  // end date defined in the `dateRange`. This `dateRange` does not specify the
497  // full date range of event data that is present in a cohort report. In a
498  // cohort report, this `dateRange` is extended by the granularity and offset
499  // present in the `cohortsRange`; event data for the extended reporting date
500  // range is present in a cohort report.
501  //
502  // In a cohort request, this `dateRange` is required and the `dateRanges` in
503  // the `RunReportRequest` or `RunPivotReportRequest` must be unspecified.
504  //
505  // This `dateRange` should generally be aligned with the cohort's granularity.
506  // If `CohortsRange` uses daily granularity, this `dateRange` can be a single
507  // day. If `CohortsRange` uses weekly granularity, this `dateRange` can be
508  // aligned to a week boundary, starting at Sunday and ending Saturday. If
509  // `CohortsRange` uses monthly granularity, this `dateRange` can be aligned to
510  // a month, starting at the first and ending on the last day of the month.
511  DateRange date_range = 3;
512}
513
514// Configures the extended reporting date range for a cohort report. Specifies
515// an offset duration to follow the cohorts over.
516message CohortsRange {
517  // The granularity used to interpret the `startOffset` and `endOffset` for the
518  // extended reporting date range for a cohort report.
519  enum Granularity {
520    // Should never be specified.
521    GRANULARITY_UNSPECIFIED = 0;
522
523    // Daily granularity. Commonly used if the cohort's `dateRange` is a single
524    // day and the request contains `cohortNthDay`.
525    DAILY = 1;
526
527    // Weekly granularity. Commonly used if the cohort's `dateRange` is a week
528    // in duration (starting on Sunday and ending on Saturday) and the request
529    // contains `cohortNthWeek`.
530    WEEKLY = 2;
531
532    // Monthly granularity. Commonly used if the cohort's `dateRange` is a month
533    // in duration and the request contains `cohortNthMonth`.
534    MONTHLY = 3;
535  }
536
537  // Required. The granularity used to interpret the `startOffset` and
538  // `endOffset` for the extended reporting date range for a cohort report.
539  Granularity granularity = 1;
540
541  // `startOffset` specifies the start date of the extended reporting date range
542  // for a cohort report. `startOffset` is commonly set to 0 so that reports
543  // contain data from the acquisition of the cohort forward.
544  //
545  // If `granularity` is `DAILY`, the `startDate` of the extended reporting date
546  // range is `startDate` of the cohort plus `startOffset` days.
547  //
548  // If `granularity` is `WEEKLY`, the `startDate` of the extended reporting
549  // date range is `startDate` of the cohort plus `startOffset * 7` days.
550  //
551  // If `granularity` is `MONTHLY`, the `startDate` of the extended reporting
552  // date range is `startDate` of the cohort plus `startOffset * 30` days.
553  int32 start_offset = 2;
554
555  // Required. `endOffset` specifies the end date of the extended reporting date
556  // range for a cohort report. `endOffset` can be any positive integer but is
557  // commonly set to 5 to 10 so that reports contain data on the cohort for the
558  // next several granularity time periods.
559  //
560  // If `granularity` is `DAILY`, the `endDate` of the extended reporting date
561  // range is `endDate` of the cohort plus `endOffset` days.
562  //
563  // If `granularity` is `WEEKLY`, the `endDate` of the extended reporting date
564  // range is `endDate` of the cohort plus `endOffset * 7` days.
565  //
566  // If `granularity` is `MONTHLY`, the `endDate` of the extended reporting date
567  // range is `endDate` of the cohort plus `endOffset * 30` days.
568  int32 end_offset = 3;
569}
570
571// Optional settings of a cohort report.
572message CohortReportSettings {
573  // If true, accumulates the result from first touch day to the end day. Not
574  // supported in `RunReportRequest`.
575  bool accumulate = 1;
576}
577
578// Response's metadata carrying additional information about the report content.
579message ResponseMetaData {
580  // The schema restrictions actively enforced in creating this report. To learn
581  // more, see [Access and data-restriction
582  // management](https://support.google.com/analytics/answer/10851388).
583  message SchemaRestrictionResponse {
584    // A metric actively restricted in creating the report.
585    message ActiveMetricRestriction {
586      // The name of the restricted metric.
587      optional string metric_name = 1;
588
589      // The reason for this metric's restriction.
590      repeated RestrictedMetricType restricted_metric_types = 2;
591    }
592
593    // All restrictions actively enforced in creating the report. For example,
594    // `purchaseRevenue` always has the restriction type `REVENUE_DATA`.
595    // However, this active response restriction is only populated if the user's
596    // custom role disallows access to `REVENUE_DATA`.
597    repeated ActiveMetricRestriction active_metric_restrictions = 1;
598  }
599
600  // If true, indicates some buckets of dimension combinations are rolled into
601  // "(other)" row. This can happen for high cardinality reports.
602  //
603  // The metadata parameter dataLossFromOtherRow is populated based on the
604  // aggregated data table used in the report. The parameter will be accurately
605  // populated regardless of the filters and limits in the report.
606  //
607  // For example, the (other) row could be dropped from the report because the
608  // request contains a filter on sessionSource = google. This parameter will
609  // still be populated if data loss from other row was present in the input
610  // aggregate data used to generate this report.
611  //
612  // To learn more, see [About the (other) row and data
613  // sampling](https://support.google.com/analytics/answer/13208658#reports).
614  bool data_loss_from_other_row = 3;
615
616  // Describes the schema restrictions actively enforced in creating this
617  // report. To learn more, see [Access and data-restriction
618  // management](https://support.google.com/analytics/answer/10851388).
619  optional SchemaRestrictionResponse schema_restriction_response = 4;
620
621  // The currency code used in this report. Intended to be used in formatting
622  // currency metrics like `purchaseRevenue` for visualization. If currency_code
623  // was specified in the request, this response parameter will echo the request
624  // parameter; otherwise, this response parameter is the property's current
625  // currency_code.
626  //
627  // Currency codes are string encodings of currency types from the ISO 4217
628  // standard (https://en.wikipedia.org/wiki/ISO_4217); for example "USD",
629  // "EUR", "JPY". To learn more, see
630  // https://support.google.com/analytics/answer/9796179.
631  optional string currency_code = 5;
632
633  // The property's current timezone. Intended to be used to interpret
634  // time-based dimensions like `hour` and `minute`. Formatted as strings from
635  // the IANA Time Zone database (https://www.iana.org/time-zones); for example
636  // "America/New_York" or "Asia/Tokyo".
637  optional string time_zone = 6;
638
639  // If empty reason is specified, the report is empty for this reason.
640  optional string empty_reason = 7;
641
642  // If `subjectToThresholding` is true, this report is subject to thresholding
643  // and only returns data that meets the minimum aggregation thresholds. It is
644  // possible for a request to be subject to thresholding thresholding and no
645  // data is absent from the report, and this happens when all data is above the
646  // thresholds. To learn more, see [Data
647  // thresholds](https://support.google.com/analytics/answer/9383630).
648  optional bool subject_to_thresholding = 8;
649
650  // If this report results is
651  // [sampled](https://support.google.com/analytics/answer/13331292), this
652  // describes the percentage of events used in this report. One
653  // `samplingMetadatas` is populated for each date range. Each
654  // `samplingMetadatas` corresponds to a date range in order that date ranges
655  // were specified in the request.
656  //
657  // However if the results are not sampled, this field will not be defined.
658  repeated SamplingMetadata sampling_metadatas = 9;
659}
660
661// If this report results is
662// [sampled](https://support.google.com/analytics/answer/13331292), this
663// describes the percentage of events used in this report. Sampling is the
664// practice of analyzing a subset of all data in order to uncover the meaningful
665// information in the larger data set.
666message SamplingMetadata {
667  // The total number of events read in this sampled report for a date range.
668  // This is the size of the subset this property's data that was analyzed in
669  // this report.
670  int64 samples_read_count = 1;
671
672  // The total number of events present in this property's data that could
673  // have been analyzed in this report for a date range. Sampling
674  // uncovers the meaningful information about the larger data set, and this
675  // is the size of the larger data set.
676  //
677  // To calculate the percentage of available data that was used in this
678  // report, compute `samplesReadCount/samplingSpaceSize`.
679  int64 sampling_space_size = 2;
680}
681
682// Describes a dimension column in the report. Dimensions requested in a report
683// produce column entries within rows and DimensionHeaders. However, dimensions
684// used exclusively within filters or expressions do not produce columns in a
685// report; correspondingly, those dimensions do not produce headers.
686message DimensionHeader {
687  // The dimension's name.
688  string name = 1;
689}
690
691// Describes a metric column in the report. Visible metrics requested in a
692// report produce column entries within rows and MetricHeaders. However,
693// metrics used exclusively within filters or expressions do not produce columns
694// in a report; correspondingly, those metrics do not produce headers.
695message MetricHeader {
696  // The metric's name.
697  string name = 1;
698
699  // The metric's data type.
700  MetricType type = 2;
701}
702
703// Dimensions' values in a single pivot.
704message PivotHeader {
705  // The size is the same as the cardinality of the corresponding dimension
706  // combinations.
707  repeated PivotDimensionHeader pivot_dimension_headers = 1;
708
709  // The cardinality of the pivot. The total number of rows for this pivot's
710  // fields regardless of how the parameters `offset` and `limit` are specified
711  // in the request.
712  int32 row_count = 2;
713}
714
715// Summarizes dimension values from a row for this pivot.
716message PivotDimensionHeader {
717  // Values of multiple dimensions in a pivot.
718  repeated DimensionValue dimension_values = 1;
719}
720
721// Report data for each row.
722// For example if RunReportRequest contains:
723//
724// ```none
725// "dimensions": [
726//   {
727//     "name": "eventName"
728//   },
729//   {
730//     "name": "countryId"
731//   }
732// ],
733// "metrics": [
734//   {
735//     "name": "eventCount"
736//   }
737// ]
738// ```
739//
740// One row with 'in_app_purchase' as the eventName, 'JP' as the countryId, and
741// 15 as the eventCount, would be:
742//
743// ```none
744// "dimensionValues": [
745//   {
746//     "value": "in_app_purchase"
747//   },
748//   {
749//     "value": "JP"
750//   }
751// ],
752// "metricValues": [
753//   {
754//     "value": "15"
755//   }
756// ]
757// ```
758message Row {
759  // List of requested dimension values. In a PivotReport, dimension_values
760  // are only listed for dimensions included in a pivot.
761  repeated DimensionValue dimension_values = 1;
762
763  // List of requested visible metric values.
764  repeated MetricValue metric_values = 2;
765}
766
767// The value of a dimension.
768message DimensionValue {
769  // One kind of dimension value
770  oneof one_value {
771    // Value as a string if the dimension type is a string.
772    string value = 1;
773  }
774}
775
776// The value of a metric.
777message MetricValue {
778  // One of metric value
779  oneof one_value {
780    // Measurement value. See MetricHeader for type.
781    string value = 4;
782  }
783}
784
785// To represent a number.
786message NumericValue {
787  // One of a numeric value
788  oneof one_value {
789    // Integer value
790    int64 int64_value = 1;
791
792    // Double value
793    double double_value = 2;
794  }
795}
796
797// Current state of all quotas for this Analytics Property. If any quota for a
798// property is exhausted, all requests to that property will return Resource
799// Exhausted errors.
800message PropertyQuota {
801  // Standard Analytics Properties can use up to 200,000 tokens per day;
802  // Analytics 360 Properties can use 2,000,000 tokens per day. Most requests
803  // consume fewer than 10 tokens.
804  QuotaStatus tokens_per_day = 1;
805
806  // Standard Analytics Properties can use up to 40,000 tokens per hour;
807  // Analytics 360 Properties can use 400,000 tokens per hour. An API request
808  // consumes a single number of tokens, and that number is deducted from all of
809  // the hourly, daily, and per project hourly quotas.
810  QuotaStatus tokens_per_hour = 2;
811
812  // Standard Analytics Properties can send up to 10 concurrent requests;
813  // Analytics 360 Properties can use up to 50 concurrent requests.
814  QuotaStatus concurrent_requests = 3;
815
816  // Standard Analytics Properties and cloud project pairs can have up to 10
817  // server errors per hour; Analytics 360 Properties and cloud project pairs
818  // can have up to 50 server errors per hour.
819  QuotaStatus server_errors_per_project_per_hour = 4;
820
821  // Analytics Properties can send up to 120 requests with potentially
822  // thresholded dimensions per hour. In a batch request, each report request
823  // is individually counted for this quota if the request contains potentially
824  // thresholded dimensions.
825  QuotaStatus potentially_thresholded_requests_per_hour = 5;
826
827  // Analytics Properties can use up to 35% of their tokens per project per
828  // hour. This amounts to standard Analytics Properties can use up to 14,000
829  // tokens per project per hour, and Analytics 360 Properties can use 140,000
830  // tokens per project per hour. An API request consumes a single number of
831  // tokens, and that number is deducted from all of the hourly, daily, and per
832  // project hourly quotas.
833  QuotaStatus tokens_per_project_per_hour = 6;
834}
835
836// Current state for a particular quota group.
837message QuotaStatus {
838  // Quota consumed by this request.
839  optional int32 consumed = 1;
840
841  // Quota remaining after this request.
842  optional int32 remaining = 2;
843}
844
845// Explains a dimension.
846message DimensionMetadata {
847  // This dimension's name. Useable in [Dimension](#Dimension)'s `name`. For
848  // example, `eventName`.
849  string api_name = 1;
850
851  // This dimension's name within the Google Analytics user interface. For
852  // example, `Event name`.
853  string ui_name = 2;
854
855  // Description of how this dimension is used and calculated.
856  string description = 3;
857
858  // Still usable but deprecated names for this dimension. If populated, this
859  // dimension is available by either `apiName` or one of `deprecatedApiNames`
860  // for a period of time. After the deprecation period, the dimension will be
861  // available only by `apiName`.
862  repeated string deprecated_api_names = 4;
863
864  // True if the dimension is a custom dimension for this property.
865  bool custom_definition = 5;
866
867  // The display name of the category that this dimension belongs to. Similar
868  // dimensions and metrics are categorized together.
869  string category = 7;
870}
871
872// Explains a metric.
873message MetricMetadata {
874  // Justifications for why this metric is blocked.
875  enum BlockedReason {
876    // Will never be specified in API response.
877    BLOCKED_REASON_UNSPECIFIED = 0;
878
879    // If present, your access is blocked to revenue related metrics for this
880    // property, and this metric is revenue related.
881    NO_REVENUE_METRICS = 1;
882
883    // If present, your access is blocked to cost related metrics for this
884    // property, and this metric is cost related.
885    NO_COST_METRICS = 2;
886  }
887
888  // A metric name. Useable in [Metric](#Metric)'s `name`. For example,
889  // `eventCount`.
890  string api_name = 1;
891
892  // This metric's name within the Google Analytics user interface. For example,
893  // `Event count`.
894  string ui_name = 2;
895
896  // Description of how this metric is used and calculated.
897  string description = 3;
898
899  // Still usable but deprecated names for this metric. If populated, this
900  // metric is available by either `apiName` or one of `deprecatedApiNames`
901  // for a period of time. After the deprecation period, the metric will be
902  // available only by `apiName`.
903  repeated string deprecated_api_names = 4;
904
905  // The type of this metric.
906  MetricType type = 5;
907
908  // The mathematical expression for this derived metric. Can be used in
909  // [Metric](#Metric)'s `expression` field for equivalent reports. Most metrics
910  // are not expressions, and for non-expressions, this field is empty.
911  string expression = 6;
912
913  // True if the metric is a custom metric for this property.
914  bool custom_definition = 7;
915
916  // If reasons are specified, your access is blocked to this metric for this
917  // property. API requests from you to this property for this metric will
918  // succeed; however, the report will contain only zeros for this metric. API
919  // requests with metric filters on blocked metrics will fail. If reasons are
920  // empty, you have access to this metric.
921  //
922  // To learn more, see [Access and data-restriction
923  // management](https://support.google.com/analytics/answer/10851388).
924  repeated BlockedReason blocked_reasons = 8;
925
926  // The display name of the category that this metrics belongs to. Similar
927  // dimensions and metrics are categorized together.
928  string category = 10;
929}
930
931// The compatibility for a single dimension.
932message DimensionCompatibility {
933  // The dimension metadata contains the API name for this compatibility
934  // information. The dimension metadata also contains other helpful information
935  // like the UI name and description.
936  optional DimensionMetadata dimension_metadata = 1;
937
938  // The compatibility of this dimension. If the compatibility is COMPATIBLE,
939  // this dimension can be successfully added to the report.
940  optional Compatibility compatibility = 2;
941}
942
943// The compatibility for a single metric.
944message MetricCompatibility {
945  // The metric metadata contains the API name for this compatibility
946  // information. The metric metadata also contains other helpful information
947  // like the UI name and description.
948  optional MetricMetadata metric_metadata = 1;
949
950  // The compatibility of this metric. If the compatibility is COMPATIBLE,
951  // this metric can be successfully added to the report.
952  optional Compatibility compatibility = 2;
953}
954
955// Represents aggregation of metrics.
956enum MetricAggregation {
957  // Unspecified operator.
958  METRIC_AGGREGATION_UNSPECIFIED = 0;
959
960  // SUM operator.
961  TOTAL = 1;
962
963  // Minimum operator.
964  MINIMUM = 5;
965
966  // Maximum operator.
967  MAXIMUM = 6;
968
969  // Count operator.
970  COUNT = 4;
971}
972
973// A metric's value type.
974enum MetricType {
975  // Unspecified type.
976  METRIC_TYPE_UNSPECIFIED = 0;
977
978  // Integer type.
979  TYPE_INTEGER = 1;
980
981  // Floating point type.
982  TYPE_FLOAT = 2;
983
984  // A duration of seconds; a special floating point type.
985  TYPE_SECONDS = 4;
986
987  // A duration in milliseconds; a special floating point type.
988  TYPE_MILLISECONDS = 5;
989
990  // A duration in minutes; a special floating point type.
991  TYPE_MINUTES = 6;
992
993  // A duration in hours; a special floating point type.
994  TYPE_HOURS = 7;
995
996  // A custom metric of standard type; a special floating point type.
997  TYPE_STANDARD = 8;
998
999  // An amount of money; a special floating point type.
1000  TYPE_CURRENCY = 9;
1001
1002  // A length in feet; a special floating point type.
1003  TYPE_FEET = 10;
1004
1005  // A length in miles; a special floating point type.
1006  TYPE_MILES = 11;
1007
1008  // A length in meters; a special floating point type.
1009  TYPE_METERS = 12;
1010
1011  // A length in kilometers; a special floating point type.
1012  TYPE_KILOMETERS = 13;
1013}
1014
1015// Categories of data that you may be restricted from viewing on certain GA4
1016// properties.
1017enum RestrictedMetricType {
1018  // Unspecified type.
1019  RESTRICTED_METRIC_TYPE_UNSPECIFIED = 0;
1020
1021  // Cost metrics such as `adCost`.
1022  COST_DATA = 1;
1023
1024  // Revenue metrics such as `purchaseRevenue`.
1025  REVENUE_DATA = 2;
1026}
1027
1028// The compatibility types for a single dimension or metric.
1029enum Compatibility {
1030  // Unspecified compatibility.
1031  COMPATIBILITY_UNSPECIFIED = 0;
1032
1033  // The dimension or metric is compatible. This dimension or metric can be
1034  // successfully added to a report.
1035  COMPATIBLE = 1;
1036
1037  // The dimension or metric is incompatible. This dimension or metric cannot be
1038  // successfully added to a report.
1039  INCOMPATIBLE = 2;
1040}
1041