Method: accounts.mediationReport.generate

Generates an AdMob Mediation report based on the provided report specification.

HTTP request

POST https://admob.googleapis.com/v1/{parent=accounts/*}/mediationReport:generate

The URL uses gRPC Transcoding syntax.

Path parameters

Parameters
parent

string

Resource name of the account to generate the report for. Example: accounts/pub-9876543210987654

Request body

The request body contains data with the following structure:

JSON representation
{
  "reportSpec": {
    object (MediationReportSpec)
  }
}
Fields
reportSpec

object (MediationReportSpec)

Network report specification.

Response body

If successful, the response body contains data with the following structure:

The streaming response for the AdMob Mediation report where the first response contains the report header, then a stream of row responses, and finally a footer as the last response message.

For example:

[{
  'header': {
    'dateRange': {
      'startDate': {'year': 2018, 'month': 9, 'day': 1},
      'endDate': {'year': 2018, 'month': 9, 'day': 30}
    }
    'localizationSettings': {
      'currencyCode': 'USD',
      'languageCode': 'en-US'
    }
  }
},
{
  'row': {
    'dimensionValues': {
      'DATE': {'value': '20180918'},
      'APP': {
        'value': 'ca-app-pub-8123415297019784~1001342552',
         displayLabel: 'My app name!'
      }
    },
    'metricValues': {
      'ESTIMATED_EARNINGS': {'decimal_value': '1324746'}
    }
  }
},
{
  'footer': {'matchingRowCount': 1}
}]
JSON representation
{

  // Union field payload can be only one of the following:
  "header": {
    object (ReportHeader)
  },
  "row": {
    object (ReportRow)
  },
  "footer": {
    object (ReportFooter)
  }
  // End of list of possible types for union field payload.
}
Fields
Union field payload. Each stream response message contains one type of payload. payload can be only one of the following:
header

object (ReportHeader)

Report generation settings that describes the report contents, such as the report date range and localization settings.

row

object (ReportRow)

Actual report data.

footer

object (ReportFooter)

Additional information about the generated report, such as warnings about the data.

Authorization Scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/admob.report

For more information, see the OAuth 2.0 Overview.

MediationReportSpec

The specification for generating an AdMob Mediation report. For example, the specification to get observed ECPM sliced by ad source and app for the 'US' and 'CN' countries can look like the following example:

{
  "dateRange": {
    "startDate": {"year": 2018, "month": 9, "day": 1},
    "endDate": {"year": 2018, "month": 9, "day": 30}
  },
  "dimensions": ["AD_SOURCE", "APP", "COUNTRY"],
  "metrics": ["OBSERVED_ECPM"],
  "dimensionFilters": [
    {
      "dimension": "COUNTRY",
      "matchesAny": {"values": [{"value": "US", "value": "CN"}]}
    }
  ],
  "sortConditions": [
    {"dimension":"APP", order: "ASCENDING"}
  ],
  "localizationSettings": {
    "currencyCode": "USD",
    "languageCode": "en-US"
  }
}

For a better understanding, you can treat the preceding specification like the following pseudo SQL:

SELECT AD_SOURCE, APP, COUNTRY, OBSERVED_ECPM
FROM MEDIATION_REPORT
WHERE DATE >= '2018-09-01' AND DATE <= '2018-09-30'
    AND COUNTRY IN ('US', 'CN')
GROUP BY AD_SOURCE, APP, COUNTRY
ORDER BY APP ASC;
JSON representation
{
  "dateRange": {
    object (DateRange)
  },
  "dimensions": [
    enum (Dimension)
  ],
  "metrics": [
    enum (Metric)
  ],
  "dimensionFilters": [
    {
      object (DimensionFilter)
    }
  ],
  "sortConditions": [
    {
      object (SortCondition)
    }
  ],
  "localizationSettings": {
    object (LocalizationSettings)
  },
  "maxReportRows": number
}
Fields
dateRange

object (DateRange)

The date range for which the report is generated.

dimensions[]

enum (Dimension)

List of dimensions of the report. The value combination of these dimensions determines the row of the report. If no dimensions are specified, the report returns a single row of requested metrics for the entire account.

metrics[]

enum (Metric)

List of metrics of the report. A report must specify at least one metric.

dimensionFilters[]

object (DimensionFilter)

Describes which report rows to match based on their dimension values.

sortConditions[]

object (SortCondition)

Describes the sorting of report rows. The order of the condition in the list defines its precedence; the earlier the condition, the higher its precedence. If no sort conditions are specified, the row ordering is undefined.

localizationSettings

object (LocalizationSettings)

Localization settings of the report.

maxReportRows

number

Maximum number of report data rows to return. If the value is not set, the API returns as many rows as possible, up to 100000. Acceptable values are 1-100000, inclusive. Any other values are treated as 100000.

Dimension

The dimensions of the mediation report. Dimensions are data attributes to break down or refine the quantitative measurements (metrics) by certain attributes, such as the ad format or the platform an ad was viewed on.

Enums
DIMENSION_UNSPECIFIED Default value for an unset field. Do not use.
DATE A date in the YYYY-MM-DD format (for example, "2018-12-21"). Requests can specify at most one time dimension.
MONTH A month in the YYYY-MM format (for example, "2018-12"). Requests can specify at most one time dimension.
WEEK The date of the first day of a week in the YYYY-MM-DD format (for example, "2018-12-21"). Requests can specify at most one time dimension.
AD_SOURCE The unique ID of the ad source (for example, "5450213213286189855" and "AdMob Network" as label value).
AD_SOURCE_INSTANCE The unique ID of the ad source instance (for example, "ca-app-pub-1234#5678" and "AdMob (default)" as label value).

Warning: The dimension is incompatible with ESTIMATED_EARNINGS and OBSERVED_ECPM metrics.
AD_UNIT The unique ID of the ad unit (for example, "ca-app-pub-1234/8790"). If AD_UNIT dimension is specified, then APP is included automatically.
APP The unique ID of the mobile application (for example, "ca-app-pub-1234~1234").
MEDIATION_GROUP The unique ID of the mediation group (for example, "ca-app-pub-1234:mg:1234" and "AdMob (default)" as label value).

Warning: The dimension is incompatible with ESTIMATED_EARNINGS and OBSERVED_ECPM metrics.
COUNTRY CLDR country code of the place where the ad views/clicks occur (for example, "US" or "FR"). This is a geography dimension.
FORMAT Format of the ad unit (for example, "banner", "native"), an ad delivery dimension.
PLATFORM Mobile OS platform of the app (for example, "Android" or "iOS").

Metric

The metrics of the mediation report. Metrics are quantitative measurements indicating how the publisher business is performing. They are aggregated from the individual ad events and grouped by the report dimensions. The metric value is either integer, or decimal (without rounding).

Enums
METRIC_UNSPECIFIED Default value for an unset field. Do not use.
AD_REQUESTS The number of requests. The value is an integer.
CLICKS The number of times a user clicks an ad. The value is an integer.
ESTIMATED_EARNINGS The estimated earnings of the AdMob publisher. The currency unit (USD, EUR, or other) of the earning metrics are determined by the localization setting for currency. The amount is in micros. For example, $6.50 would be represented as 6500000.

Warning: The metric is incompatible with AD_SOURCE_INSTANCE and MEDIATION_GROUP dimensions.
IMPRESSIONS The total number of ads shown to users. The value is an integer.
IMPRESSION_CTR The ratio of clicks over impressions. The value is a double precision (approximate) decimal value.
MATCHED_REQUESTS The number of times ads are returned in response to a request. The value is an integer.
MATCH_RATE The ratio of matched ad requests over the total ad requests. The value is a double precision (approximate) decimal value.
OBSERVED_ECPM The third-party ad network's estimated average eCPM. The currency unit (USD, EUR, or other) of the earning metrics are determined by the localization setting for currency. The amount is in micros. For example, $2.30 would be represented as 2300000.

Warning: The metric is incompatible with AD_SOURCE_INSTANCE and MEDIATION_GROUP dimensions.

DimensionFilter

Describes which report rows to match based on their dimension values.

JSON representation
{
  "dimension": enum (Dimension),
  "matchesAny": {
    object (StringList)
  }
}
Fields
dimension

enum (Dimension)

Applies the filter criterion to the specified dimension.

matchesAny

object (StringList)

Matches a row if its value for the specified dimension is in one of the values specified in this condition.

SortCondition

Sorting direction to be applied on a dimension or a metric.

JSON representation
{
  "order": enum (SortOrder),

  // Union field sort_on can be only one of the following:
  "dimension": enum (Dimension),
  "metric": enum (Metric)
  // End of list of possible types for union field sort_on.
}
Fields
order

enum (SortOrder)

Sorting order of the dimension or metric.

Union field sort_on. Identifies which values to sort on. sort_on can be only one of the following:
dimension

enum (Dimension)

Sort by the specified dimension.

metric

enum (Metric)

Sort by the specified metric.