data.proto 35 KB

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