xref: /aosp_15_r20/external/googleapis/google/ads/admob/v1/admob_resources.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1// Copyright 2020 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.ads.admob.v1;
18
19import "google/api/field_behavior.proto";
20import "google/api/resource.proto";
21import "google/type/date.proto";
22
23option go_package = "google.golang.org/genproto/googleapis/ads/admob/v1;admob";
24option java_outer_classname = "AdMobResourcesProto";
25option java_package = "com.google.ads.admob.v1";
26
27// The sorting order.
28enum SortOrder {
29  // Default value for an unset field. Do not use.
30  SORT_ORDER_UNSPECIFIED = 0;
31
32  // Sort dimension value or metric value in ascending order.
33  ASCENDING = 1;
34
35  // Sort dimension value or metric value in descending order.
36  DESCENDING = 2;
37}
38
39// A publisher account contains information relevant to the use of this API,
40// such as the time zone used for the reports.
41message PublisherAccount {
42  option (google.api.resource) = {
43    type: "admob.googleapis.com/PublisherAccount"
44    pattern: "accounts/{publisher}"
45  };
46
47  // Resource name of this account.
48  // Format is accounts/{publisher_id}.
49  string name = 1;
50
51  // The unique ID by which this publisher account can be identified
52  // in the API requests (for example, pub-1234567890).
53  string publisher_id = 2;
54
55  // The time zone that is used in reports that are generated for this account.
56  // The value is a time-zone ID as specified by the CLDR project,
57  // for example, "America/Los_Angeles".
58  string reporting_time_zone = 3;
59
60  // Currency code of the earning-related metrics, which is the 3-letter code
61  // defined in ISO 4217. The daily average rate is used for the currency
62  // conversion.
63  string currency_code = 4;
64}
65
66// The specification for generating an AdMob Network report.
67// For example, the specification to get clicks and estimated earnings for only
68// the 'US' and 'CN' countries can look like the following example:
69//
70//     {
71//       'date_range': {
72//         'start_date': {'year': 2018, 'month': 9, 'day': 1},
73//         'end_date': {'year': 2018, 'month': 9, 'day': 30}
74//       },
75//       'dimensions': ['DATE', 'APP', 'COUNTRY'],
76//       'metrics': ['CLICKS', 'ESTIMATED_EARNINGS'],
77//       'dimension_filters': [
78//         {
79//           'dimension': 'COUNTRY',
80//           'matches_any': {'values': [{'value': 'US', 'value': 'CN'}]}
81//         }
82//       ],
83//       'sort_conditions': [
84//         {'dimension':'APP', order: 'ASCENDING'},
85//         {'metric':'CLICKS', order: 'DESCENDING'}
86//       ],
87//       'localization_settings': {
88//         'currency_code': 'USD',
89//         'language_code': 'en-US'
90//       }
91//     }
92//
93// For a better understanding, you can treat the preceding specification like
94// the following pseudo SQL:
95//
96//     SELECT DATE, APP, COUNTRY, CLICKS, ESTIMATED_EARNINGS
97//     FROM NETWORK_REPORT
98//     WHERE DATE >= '2018-09-01' AND DATE <= '2018-09-30'
99//         AND COUNTRY IN ('US', 'CN')
100//     GROUP BY DATE, APP, COUNTRY
101//     ORDER BY APP ASC, CLICKS DESC;
102message NetworkReportSpec {
103  // Describes which report rows to match based on their dimension values.
104  message DimensionFilter {
105    // Filter operator to be applied.
106    oneof operator {
107      // Matches a row if its value for the specified dimension is in one of the
108      // values specified in this condition.
109      StringList matches_any = 2;
110    }
111
112    // Applies the filter criterion to the specified dimension.
113    Dimension dimension = 1;
114  }
115
116  // Sorting direction to be applied on a dimension or a metric.
117  message SortCondition {
118    // Identifies which values to sort on.
119    oneof sort_on {
120      // Sort by the specified dimension.
121      Dimension dimension = 1;
122
123      // Sort by the specified metric.
124      Metric metric = 2;
125    }
126
127    // Sorting order of the dimension or metric.
128    SortOrder order = 3;
129  }
130
131  // The dimensions of the network report. Dimensions are data attributes to
132  // break down or refine the quantitative measurements (metrics) by certain
133  // attributes, such as the ad format or the platform an ad was viewed on.
134  enum Dimension {
135    // Default value for an unset field. Do not use.
136    DIMENSION_UNSPECIFIED = 0;
137
138    // A date in the YYYY-MM-DD format (for example, "2018-12-21"). Requests can
139    // specify at most one time dimension.
140    DATE = 1;
141
142    // A month in the YYYY-MM format (for example, "2018-12"). Requests can
143    // specify at most one time dimension.
144    MONTH = 2;
145
146    // The date of the first day of a week in the YYYY-MM-DD format
147    // (for example, "2018-12-21"). Requests can specify at most one time
148    // dimension.
149    WEEK = 3;
150
151    // The unique ID of the ad unit (for example, "ca-app-pub-1234/1234").
152    // If AD_UNIT dimension is specified, then APP is included automatically.
153    AD_UNIT = 4;
154
155    // The unique ID of the mobile application (for example,
156    // "ca-app-pub-1234~1234").
157    APP = 5;
158
159    // Type of the ad (for example, "text" or "image"), an ad delivery
160    // dimension.
161    //
162    // **Warning:** The dimension is incompatible with
163    // [AD_REQUESTS](#Metric.ENUM_VALUES.AD_REQUESTS),
164    // [MATCH_RATE](#Metric.ENUM_VALUES.MATCH_RATE) and
165    // [IMPRESSION_RPM](#Metric.ENUM_VALUES.IMPRESSION_RPM) metrics.
166    AD_TYPE = 6;
167
168    // CLDR country code of the place where the ad views/clicks occur (for
169    // example, "US" or "FR"). This is a geography dimension.
170    COUNTRY = 7;
171
172    // Format of the ad unit (for example, "banner", "native"), an ad delivery
173    // dimension.
174    FORMAT = 8;
175
176    // Mobile OS platform of the app (for example, "Android" or "iOS").
177    PLATFORM = 9;
178  }
179
180  // The metrics of the network report. Metrics are quantitative measurements
181  // indicating how the publisher business is performing. They are aggregated
182  // from the individual ad events and grouped by the report dimensions. The
183  // metric value is either integer, or decimal (without rounding).
184  enum Metric {
185    // Default value for an unset field. Do not use.
186    METRIC_UNSPECIFIED = 0;
187
188    // The number of ad requests. The value is an integer.
189    //
190    // **Warning:** The metric is incompatible with
191    // [AD_TYPE](#Dimension.ENUM_VALUES.AD_TYPE) dimension.
192    AD_REQUESTS = 1;
193
194    // The number of times a user clicks an ad. The value is an integer.
195    CLICKS = 2;
196
197    // The estimated earnings of the AdMob publisher. The currency unit (USD,
198    // EUR, or other) of the earning metrics are determined by the localization
199    // setting for currency. The amount is in micros. For example, $6.50 would
200    // be represented as 6500000.
201    ESTIMATED_EARNINGS = 3;
202
203    // The total number of ads shown to users. The value is an integer.
204    IMPRESSIONS = 4;
205
206    // The ratio of clicks over impressions. The value is a double precision
207    // (approximate) decimal value.
208    IMPRESSION_CTR = 5;
209
210    // The estimated earnings per thousand ad impressions. The value is in
211    // micros. For example, $1.03 would be represented as 1030000.
212    //
213    // **Warning:** The metric is incompatible with
214    // [AD_TYPE](#Dimension.ENUM_VALUES.AD_TYPE) dimension.
215    IMPRESSION_RPM = 6;
216
217    // The number of times ads are returned in response to a request. The value
218    // is an integer.
219    MATCHED_REQUESTS = 7;
220
221    // The ratio of matched ad requests over the total ad requests. The value is
222    // a double precision (approximate) decimal value.
223    //
224    // **Warning:** The metric is incompatible with
225    // [AD_TYPE](#Dimension.ENUM_VALUES.AD_TYPE) dimension.
226    MATCH_RATE = 8;
227
228    // The ratio of ads that are displayed over ads that are returned, defined
229    // as impressions / matched requests. The value is a double precision
230    // (approximate) decimal value.
231    SHOW_RATE = 9;
232  }
233
234  // The date range for which the report is generated.
235  DateRange date_range = 1;
236
237  // List of dimensions of the report. The value combination of these dimensions
238  // determines the row of the report. If no dimensions are specified, the
239  // report returns a single row of requested metrics for the entire account.
240  repeated Dimension dimensions = 2;
241
242  // List of metrics of the report. A report must specify at least one metric.
243  repeated Metric metrics = 3;
244
245  // Describes which report rows to match based on their dimension values.
246  repeated DimensionFilter dimension_filters = 4;
247
248  // Describes the sorting of report rows. The order of the condition in the
249  // list defines its precedence; the earlier the condition, the higher its
250  // precedence. If no sort conditions are specified, the row ordering is
251  // undefined.
252  repeated SortCondition sort_conditions = 5;
253
254  // Localization settings of the report.
255  LocalizationSettings localization_settings = 6;
256
257  // Maximum number of report data rows to return. If the value is not set, the
258  // API returns as many rows as possible, up to 100000. Acceptable values are
259  // 1-100000, inclusive. Any other values are treated as 100000.
260  int32 max_report_rows = 7;
261
262  // A report time zone. Accepts an IANA TZ name values, such as
263  // "America/Los_Angeles."  If no time zone is defined, the account default
264  // takes effect. Check default value by the get account action.
265  //
266  // **Warning:** The "America/Los_Angeles" is the only supported value at
267  // the moment.
268  string time_zone = 8;
269}
270
271// The specification for generating an AdMob Mediation report.
272// For example, the specification to get observed ECPM sliced by ad source and
273// app for the 'US' and 'CN' countries can look like the following example:
274//
275//     {
276//       "date_range": {
277//         "start_date": {"year": 2018, "month": 9, "day": 1},
278//         "end_date": {"year": 2018, "month": 9, "day": 30}
279//       },
280//       "dimensions": ["AD_SOURCE", "APP", "COUNTRY"],
281//       "metrics": ["OBSERVED_ECPM"],
282//       "dimension_filters": [
283//         {
284//           "dimension": "COUNTRY",
285//           "matches_any": {"values": [{"value": "US", "value": "CN"}]}
286//         }
287//       ],
288//       "sort_conditions": [
289//         {"dimension":"APP", order: "ASCENDING"}
290//       ],
291//       "localization_settings": {
292//         "currency_code": "USD",
293//         "language_code": "en-US"
294//       }
295//     }
296//
297// For a better understanding, you can treat the preceding specification like
298// the following pseudo SQL:
299//
300//     SELECT AD_SOURCE, APP, COUNTRY, OBSERVED_ECPM
301//     FROM MEDIATION_REPORT
302//     WHERE DATE >= '2018-09-01' AND DATE <= '2018-09-30'
303//         AND COUNTRY IN ('US', 'CN')
304//     GROUP BY AD_SOURCE, APP, COUNTRY
305//     ORDER BY APP ASC;
306message MediationReportSpec {
307  // Describes which report rows to match based on their dimension values.
308  message DimensionFilter {
309    // Filter operator to be applied.
310    oneof operator {
311      // Matches a row if its value for the specified dimension is in one of the
312      // values specified in this condition.
313      StringList matches_any = 2;
314    }
315
316    // Applies the filter criterion to the specified dimension.
317    Dimension dimension = 1;
318  }
319
320  // Sorting direction to be applied on a dimension or a metric.
321  message SortCondition {
322    // Identifies which values to sort on.
323    oneof sort_on {
324      // Sort by the specified dimension.
325      Dimension dimension = 1;
326
327      // Sort by the specified metric.
328      Metric metric = 2;
329    }
330
331    // Sorting order of the dimension or metric.
332    SortOrder order = 3;
333  }
334
335  // The dimensions of the mediation report. Dimensions are data attributes to
336  // break down or refine the quantitative measurements (metrics) by certain
337  // attributes, such as the ad format or the platform an ad was viewed on.
338  enum Dimension {
339    // Default value for an unset field. Do not use.
340    DIMENSION_UNSPECIFIED = 0;
341
342    // A date in the YYYY-MM-DD format (for example, "2018-12-21"). Requests can
343    // specify at most one time dimension.
344    DATE = 1;
345
346    // A month in the YYYY-MM format (for example, "2018-12"). Requests can
347    // specify at most one time dimension.
348    MONTH = 2;
349
350    // The date of the first day of a week in the YYYY-MM-DD format
351    // (for example, "2018-12-21"). Requests can specify at most one time
352    // dimension.
353    WEEK = 3;
354
355    // The [unique ID of the ad source](/admob/api/v1/ad_sources) (for example,
356    // "5450213213286189855" and "AdMob Network" as label value).
357    AD_SOURCE = 4;
358
359    // The unique ID of the ad source instance (for example,
360    // "ca-app-pub-1234#5678" and "AdMob (default)" as label value).
361    AD_SOURCE_INSTANCE = 5;
362
363    // The unique ID of the ad unit (for example, "ca-app-pub-1234/8790").
364    // If AD_UNIT dimension is specified, then APP is included automatically.
365    AD_UNIT = 6;
366
367    // The unique ID of the mobile application (for example,
368    // "ca-app-pub-1234~1234").
369    APP = 7;
370
371    // The unique ID of the mediation group (for example,
372    // "ca-app-pub-1234:mg:1234" and "AdMob (default)" as label value).
373    MEDIATION_GROUP = 11;
374
375    // CLDR country code of the place where the ad views/clicks occur (for
376    // example, "US" or "FR"). This is a geography dimension.
377    COUNTRY = 8;
378
379    // Format of the ad unit (for example, "banner", "native"), an ad delivery
380    // dimension.
381    FORMAT = 9;
382
383    // Mobile OS platform of the app (for example, "Android" or "iOS").
384    PLATFORM = 10;
385  }
386
387  // The metrics of the mediation report. Metrics are quantitative measurements
388  // indicating how the publisher business is performing. They are aggregated
389  // from the individual ad events and grouped by the report dimensions. The
390  // metric value is either integer, or decimal (without rounding).
391  enum Metric {
392    // Default value for an unset field. Do not use.
393    METRIC_UNSPECIFIED = 0;
394
395    // The number of requests. The value is an integer.
396    AD_REQUESTS = 1;
397
398    // The number of times a user clicks an ad. The value is an integer.
399    CLICKS = 2;
400
401    // The estimated earnings of the AdMob publisher. The currency unit (USD,
402    // EUR, or other) of the earning metrics are determined by the localization
403    // setting for currency. The amount is in micros. For example, $6.50 would
404    // be represented as 6500000.
405    //
406    // Estimated earnings per mediation group and per ad source instance level
407    // is supported dating back to October 20, 2019. Third-party estimated
408    // earnings will show 0 for dates prior to October 20, 2019.
409    ESTIMATED_EARNINGS = 3;
410
411    // The total number of ads shown to users. The value is an integer.
412    IMPRESSIONS = 4;
413
414    // The ratio of clicks over impressions. The value is a double precision
415    // (approximate) decimal value.
416    IMPRESSION_CTR = 5;
417
418    // The number of times ads are returned in response to a request. The value
419    // is an integer.
420    MATCHED_REQUESTS = 6;
421
422    // The ratio of matched ad requests over the total ad requests. The value is
423    // a double precision (approximate) decimal value.
424    MATCH_RATE = 7;
425
426    // The third-party ad network's estimated average eCPM. The currency unit
427    // (USD, EUR, or other) of the earning metrics are determined by the
428    // localization setting for currency. The amount is in micros. For example,
429    // $2.30 would be represented as 2300000.
430    //
431    // The estimated average eCPM per mediation group and per ad source instance
432    // level is supported dating back to October 20, 2019. Third-party estimated
433    // average eCPM will show 0 for dates prior to October 20, 2019.
434    OBSERVED_ECPM = 8;
435  }
436
437  // The date range for which the report is generated.
438  DateRange date_range = 1;
439
440  // List of dimensions of the report. The value combination of these dimensions
441  // determines the row of the report. If no dimensions are specified, the
442  // report returns a single row of requested metrics for the entire account.
443  repeated Dimension dimensions = 2;
444
445  // List of metrics of the report. A report must specify at least one metric.
446  repeated Metric metrics = 3;
447
448  // Describes which report rows to match based on their dimension values.
449  repeated DimensionFilter dimension_filters = 4;
450
451  // Describes the sorting of report rows. The order of the condition in the
452  // list defines its precedence; the earlier the condition, the higher its
453  // precedence. If no sort conditions are specified, the row ordering is
454  // undefined.
455  repeated SortCondition sort_conditions = 5;
456
457  // Localization settings of the report.
458  LocalizationSettings localization_settings = 6;
459
460  // Maximum number of report data rows to return. If the value is not set, the
461  // API returns as many rows as possible, up to 100000. Acceptable values are
462  // 1-100000, inclusive. Any other values are treated as 100000.
463  int32 max_report_rows = 7;
464
465  // A report time zone. Accepts an IANA TZ name values, such as
466  // "America/Los_Angeles."  If no time zone is defined, the account default
467  // takes effect. Check default value by the get account action.
468  //
469  // **Warning:** The "America/Los_Angeles" is the only supported value at
470  // the moment.
471  string time_zone = 8;
472}
473
474// A row of the returning report.
475message ReportRow {
476  // Representation of a dimension value.
477  message DimensionValue {
478    // Dimension value in the format specified in the report's spec Dimension
479    // enum.
480    string value = 1;
481
482    // The localized string representation of the value. If unspecified, the
483    // display label should be derived from the value.
484    string display_label = 2;
485  }
486
487  // Representation of a metric value.
488  message MetricValue {
489    // Metric value in the format specified in the report's spec Metric enum
490    // name.
491    oneof value {
492      // Metric integer value.
493      int64 integer_value = 1;
494
495      // Double precision (approximate) decimal values. Rates are from 0 to 1.
496      double double_value = 2;
497
498      // Amount in micros. One million is equivalent to one unit. Currency value
499      // is in the unit (USD, EUR or other) specified by the request.
500      // For example, $6.50 whould be represented as 6500000 micros.
501      int64 micros_value = 3;
502    }
503  }
504
505  // Map of dimension values in a row, with keys as enum name of the dimensions.
506  map<string, DimensionValue> dimension_values = 1;
507
508  // Map of metric values in a row, with keys as enum name of the metrics. If
509  // a metric being requested has no value returned, the map will not include
510  // it.
511  map<string, MetricValue> metric_values = 2;
512}
513
514// Warnings associated with generation of the report.
515message ReportWarning {
516  // Warning type.
517  enum Type {
518    // Default value for an unset field. Do not use.
519    TYPE_UNSPECIFIED = 0;
520
521    // Some data in this report is aggregated based on a time zone different
522    // from the requested time zone. This could happen if a local time-zone
523    // report has the start time before the last time this time zone changed.
524    // The description field will contain the date of the last time zone
525    // change.
526    DATA_BEFORE_ACCOUNT_TIMEZONE_CHANGE = 1;
527
528    // There is an unusual delay in processing the source data for the
529    // requested date range. The report results might be less up to date than
530    // usual. AdMob is aware of the issue and is actively working to resolve
531    // it.
532    DATA_DELAYED = 2;
533
534    // Warnings that are exposed without a specific type. Useful when new
535    // warning types are added but the API is not changed yet.
536    OTHER = 3;
537
538    // The currency being requested is not the account currency. The earning
539    // metrics will be based on the requested currency, and thus not a good
540    // estimation of the final payment anymore, due to the currency rate
541    // fluctuation.
542    REPORT_CURRENCY_NOT_ACCOUNT_CURRENCY = 4;
543  }
544
545  // Type of the warning.
546  Type type = 1;
547
548  // Describes the details of the warning message, in English.
549  string description = 2;
550}
551
552// Groups data helps to treat the generated report. Always sent as a first
553// message in the stream response.
554message ReportHeader {
555  // The date range for which the report is generated. This is identical to the
556  // range specified in the report request.
557  DateRange date_range = 1;
558
559  // Localization settings of the report. This is identical to the settings
560  // in the report request.
561  LocalizationSettings localization_settings = 2;
562
563  // The report time zone. The value is a time-zone ID as specified by the CLDR
564  // project, for example, "America/Los_Angeles".
565  string reporting_time_zone = 3;
566}
567
568// Groups data available after report generation, for example, warnings and row
569// counts. Always sent as the last message in the stream response.
570message ReportFooter {
571  // Warnings associated with generation of the report.
572  repeated ReportWarning warnings = 1;
573
574  // Total number of rows that matched the request.
575  //
576  // Warning: This count does NOT always match the number of rows in the
577  // response. Do not make that assumption when processing the response.
578  int64 matching_row_count = 2;
579}
580
581// Specification of a single date range. Both dates are inclusive.
582message DateRange {
583  // Start date of the date range, inclusive. Must be less than or equal to the
584  // end date.
585  google.type.Date start_date = 1;
586
587  // End date of the date range, inclusive. Must be greater than or equal to the
588  // start date.
589  google.type.Date end_date = 2;
590}
591
592// Localization settings for reports, such as currency and language. It affects
593// how metrics are calculated.
594message LocalizationSettings {
595  // Currency code of the earning related metrics, which is the 3-letter code
596  // defined in ISO 4217. The daily average rate is used for the currency
597  // conversion. Defaults to the account currency code if unspecified.
598  string currency_code = 1;
599
600  // Language used for any localized text, such as some dimension value display
601  // labels. The language tag defined in the IETF BCP47. Defaults to 'en-US' if
602  // unspecified.
603  string language_code = 2;
604}
605
606// List of string values.
607message StringList {
608  // The string values.
609  repeated string values = 1;
610}
611