Method: accounts.networkReport.generate

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

HTTP request

POST https://admob.googleapis.com/v1/{parent=accounts/*}/networkReport: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 (NetworkReportSpec)
  }
}
Fields
reportSpec

object (NetworkReportSpec)

Network report specification.

Response body

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

The streaming response for the AdMob Network 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': {'microsValue': 6500000}
    }
  }
},
...
{
  'footer': {'matchingRowCount': 5}
}]
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.

NetworkReportSpec

The specification for generating an AdMob Network report. For example, the specification to get clicks and estimated earnings for only 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': ['DATE', 'APP', 'COUNTRY'],
  'metrics': ['CLICKS', 'ESTIMATED_EARNINGS'],
  'dimensionFilters': [
    {
      'dimension': 'COUNTRY',
      'matchesAny': {'values': [{'value': 'US', 'value': 'CN'}]}
    }
  ],
  'sortConditions': [
    {'dimension':'APP', order: 'ASCENDING'},
    {'metric':'CLICKS', order: 'DESCENDING'}
  ],
  'localizationSettings': {
    'currencyCode': 'USD',
    'languageCode': 'en-US'
  }
}

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

SELECT DATE, APP, COUNTRY, CLICKS, ESTIMATED_EARNINGS
FROM NETWORK_REPORT
WHERE DATE >= '2018-09-01' AND DATE <= '2018-09-30'
    AND COUNTRY IN ('US', 'CN')
GROUP BY DATE, APP, COUNTRY
ORDER BY APP ASC, CLICKS DESC;
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 network 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_UNIT The unique ID of the ad unit (for example, "ca-app-pub-1234/1234"). 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").
AD_TYPE Type of the ad (for example, "text" or "image"), an ad delivery dimension.
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 network 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 ad 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.
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.
IMPRESSION_RPM The estimated earnings per thousand ad impressions. The value is in micros. For example, $1.03 would be represented as 1030000.
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.
SHOW_RATE The ratio of ads that are displayed over ads that are returned, defined as impressions / matched requests. The value is a double precision (approximate) decimal value.

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.