Method: accounts.networkReport.generate

Generates an AdMob Network report based on the provided report specification. Returns result of a server-side streaming RPC. The result is returned in a sequence of responses.

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

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": 1}
    },
    "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": 1}
}]

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

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 one of the following OAuth scopes:

  • https://www.googleapis.com/auth/admob.readonly
  • 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': 2021, 'month': 9, 'day': 1},
    'endDate': {'year': 2021, '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 >= '2021-09-01' AND DATE <= '2021-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": integer,
  "timeZone": string
}
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

integer

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. Values larger than 100000 return an error.

timeZone

string

A report time zone. Accepts an IANA TZ name values, such as "America/Los_Angeles." If no time zone is defined, the account default takes effect. Check default value by the get account action.

Warning: The "America/Los_Angeles" is the only supported value at the moment.

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 YYYYMMDD format (for example, "20210701"). Requests can specify at most one time dimension.
MONTH A month in the YYYYMM format (for example, "202107"). Requests can specify at most one time dimension.
WEEK The date of the first day of a week in the YYYYMMDD format (for example, "20210701"). 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.

Warning: The dimension is incompatible with AD_REQUESTS, MATCH_RATE and IMPRESSION_RPM 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").
MOBILE_OS_VERSION Mobile operating system version, e.g. "iOS 13.5.1".
GMA_SDK_VERSION GMA SDK version, e.g. "iOS 7.62.0".
APP_VERSION_NAME For Android, the app version name can be found in versionName in PackageInfo. For iOS, the app version name can be found in CFBundleShortVersionString.
SERVING_RESTRICTION Restriction mode for ads serving (e.g. "Non-personalized ads").

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.

Warning: The metric is incompatible with AD_TYPE dimension.

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. Equivalent to eCPM in the AdMob UI.

Warning: The metric is incompatible with AD_TYPE dimension.

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.

Warning: The metric is incompatible with AD_TYPE dimension.

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),

  // Union field operator can be only one of the following:
  "matchesAny": {
    object (StringList)
  }
  // End of list of possible types for union field operator.
}
Fields
dimension

enum (Dimension)

Applies the filter criterion to the specified dimension.

Union field operator. Filter operator to be applied. operator can be only one of the following:
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.