AdSense Management API

Reports: generate

Deprecated: Due to the possibility of ambiguity, accounts with both an AdSense publisher account and an AdExchange account will throw an error when trying to use the default account. Always use accounts.list to check if there's more than one account and let the user choose in that case. After that, specify the account ID on every call using the /accounts/ namespace.

Requires authorization

Generate an AdSense report based on the report request sent in the query parameters. Returns the result as JSON; to retrieve output in CSV format specify "alt=csv" as a query parameter. Try it now.

Request

HTTP request

GET https://www.googleapis.com/adsense/v1.2/reports

Parameters

Parameter name Value Description
Required parameters
endDate string End of the date range to report on in "YYYY-MM-DD" format, inclusive.
startDate string Start of the date range to report on in "YYYY-MM-DD" format, inclusive.
Optional parameters
accountId string Accounts upon which to report.
currency string The currency to use when reporting on monetary metrics. Defaults to the account's currency if not set.
dimension string The dimensions on which to base the report. Available dimensions are described in Metrics and Dimensions. For more information on each of the dimensions, check the AdSense Glossary.
filter string Filters to be applied to the report.
locale string The locale to use for translating report output to a local language. Defaults to "en_US" if not specified.
maxResults integer The maximum number of rows of report data to return. If startIndex is either unset or zero, the API will return as many rows as specified by the value of maxResults. If maxResults is not set the API will return as many rows as possible, up to 50,000. If startIndex is set to a non-zero value, the sum of startIndex and maxResults cannot be greater than 5000, or an error will be returned: paging past row 5000 is unsupported. Acceptable values are 0 to 50000, inclusive.
metric string The numeric columns to include in the report. Available metrics are described in Metrics and Dimensions. For more information on each of the metrics, check the AdSense Glossary.
sort string The name of a dimension or metric on which to sort the resulting report. Optionally prefixed with "+" to sort ascending or "-" to sort descending. If no prefix is specified, the column is sorted ascending.
startIndex integer Index of the first row of report data to return. If startIndex is either unset or zero, the API will return as many rows as specified by the value of maxResults. If maxResults is not set the API will return as many rows as possible, up to 50,000. If startIndex is set to a non-zero value, the sum of startIndex and maxResults cannot be greater than 5000, or an error will be returned: paging past row 5000 is unsupported. Acceptable values are 0 to 5000, inclusive.

Authorization

This request requires authorization with at least one of the following scopes (read more about authentication and authorization).

Scope
https://www.googleapis.com/auth/adsense
https://www.googleapis.com/auth/adsense.readonly

Request body

Do not supply a request body with this method.

Response

If successful, this method returns a response body with the following structure:

JSON

{
  "kind": "adsense#report",
  "totalMatchedRows": long,
  "headers": [
    {
      "name": string,
      "type": string,
      "currency": string
    }
  ],
  "rows": [
    [
      string
    ]
  ],
  "totals": [
    string
  ],
  "averages": [
    string
  ],
  "warnings": [
    string
  ]
}
Property name Value Description Notes
kind string Kind this is, in this case adsense#report.
totalMatchedRows long The total number of rows matched by the report request. Fewer rows may be returned in the response due to being limited by the row count requested or the report row limit.
headers[] list The header information of the columns requested in the report. This is a list of headers; one for each dimension in the request, followed by one for each metric in the request.
headers[].name string The name of the header.
headers[].type string The type of the header; one of DIMENSION, METRIC_TALLY, METRIC_RATIO, or METRIC_CURRENCY.
headers[].currency string The currency of this column. Only present if the header type is METRIC_CURRENCY.
rows[] list The output rows of the report. Each row is a list of cells; one for each dimension in the request, followed by one for each metric in the request. The dimension cells contain strings, and the metric cells contain numbers.
totals[] list The totals of the report. This is the same length as any other row in the report; cells corresponding to dimension columns are empty.
averages[] list The averages of the report. This is the same length as any other row in the report; cells corresponding to dimension columns are empty.
warnings[] list Any warnings associated with generation of the report.

CSV

"(dynamic)"
(foreach)
  (value)
(/foreach)
(dynamic)">
Property name Value Description Notes
(dynamic) (any)

Try it!

Use the APIs Explorer below to call this method on live data and see the response.

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.