# Method: accounts.campaignReport.generate

- [HTTP request](https://developers.google.com/admob/api/reference/rest/v1beta/accounts.campaignReport/generate#body.HTTP_TEMPLATE)
- [Path parameters](https://developers.google.com/admob/api/reference/rest/v1beta/accounts.campaignReport/generate#body.PATH_PARAMETERS)
- [Request body](https://developers.google.com/admob/api/reference/rest/v1beta/accounts.campaignReport/generate#body.request_body)
  - [JSON representation](https://developers.google.com/admob/api/reference/rest/v1beta/accounts.campaignReport/generate#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://developers.google.com/admob/api/reference/rest/v1beta/accounts.campaignReport/generate#body.response_body)
  - [JSON representation](https://developers.google.com/admob/api/reference/rest/v1beta/accounts.campaignReport/generate#body.GenerateCampaignReportResponse.SCHEMA_REPRESENTATION)
- [Authorization scopes](https://developers.google.com/admob/api/reference/rest/v1beta/accounts.campaignReport/generate#body.aspect)
- [CampaignReportSpec](https://developers.google.com/admob/api/reference/rest/v1beta/accounts.campaignReport/generate#CampaignReportSpec)
  - [JSON representation](https://developers.google.com/admob/api/reference/rest/v1beta/accounts.campaignReport/generate#CampaignReportSpec.SCHEMA_REPRESENTATION)
- [Dimension](https://developers.google.com/admob/api/reference/rest/v1beta/accounts.campaignReport/generate#Dimension)
- [Metric](https://developers.google.com/admob/api/reference/rest/v1beta/accounts.campaignReport/generate#Metric)
- [Examples](https://developers.google.com/admob/api/reference/rest/v1beta/accounts.campaignReport/generate#examples)
- [Try it!](https://developers.google.com/admob/api/reference/rest/v1beta/accounts.campaignReport/generate#try-it)

Generates Campaign Report based on provided specifications.

### HTTP request

`POST https://admob.googleapis.com/v1beta/{parent=accounts/*}/campaignReport:generate`

The URL uses [gRPC Transcoding](https://google.aip.dev/127) 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 (`https://developers.google.com/admob/api/reference/rest/v1beta/accounts.campaignReport/generate#CampaignReportSpec`) } } ``` |

| Fields ||
|---|---|
| `reportSpec` | ``object (`https://developers.google.com/admob/api/reference/rest/v1beta/accounts.campaignReport/generate#CampaignReportSpec`)`` Campaign report specification. |

### Response body

Campaign Report API response.

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

| JSON representation |
|---|
| ``` { "rows": [ { object (`https://developers.google.com/admob/api/reference/rest/v1beta/ReportRow`) } ] } ``` |

| Fields ||
|---|---|
| `rows[]` | ``object (`https://developers.google.com/admob/api/reference/rest/v1beta/ReportRow`)`` The campaign report data from the specified publisher. At most 100000 rows will be returned from the API. |

### 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](https://developers.google.com/identity/protocols/OAuth2).

## CampaignReportSpec

The specification for generating a Campaign report. For example, the specification to get IMPRESSIONS and CLICKS sliced by CAMPAIGN_ID can look like the following example:

    {
      "dateRange": {
        "startDate": {"year": 2021, "month": 12, "day": 1},
        "endDate": {"year": 2021, "month": 12, "day": 30}
      },
      "dimensions": ["CAMPAIGN_ID"],
      "metrics": ["IMPRESSIONS", "CLICKS"],
    }

| JSON representation |
|---|
| ``` { "dateRange": { object (`https://developers.google.com/admob/api/reference/rest/v1beta/DateRange`) }, "dimensions": [ enum (`https://developers.google.com/admob/api/reference/rest/v1beta/accounts.campaignReport/generate#Dimension`) ], "metrics": [ enum (`https://developers.google.com/admob/api/reference/rest/v1beta/accounts.campaignReport/generate#Metric`) ], "languageCode": string } ``` |

| Fields ||
|---|---|
| `dateRange` | ``object (`https://developers.google.com/admob/api/reference/rest/v1beta/DateRange`)`` The date range for which the report is generated. The max range is 30 days. |
| `dimensions[]` | ``enum (`https://developers.google.com/admob/api/reference/rest/v1beta/accounts.campaignReport/generate#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 (`https://developers.google.com/admob/api/reference/rest/v1beta/accounts.campaignReport/generate#Metric`)`` List of metrics of the report. A report must specify at least one metric. |
| `languageCode` | `string` Language used for any localized text, such as certain applicable dimension values. The language tag is defined in the IETF BCP47. Defaults to 'en-US' if unspecified or invalid. |

## Dimension

The dimensions of the campaign report.

| Enums ||
|---|---|
| `DIMENSION_UNSPECIFIED` | Default value of an unspecified dimension. Do not use. |
| `DATE` | A date in the YYYYMMDD format (for example, "20210701"). |
| `CAMPAIGN_ID` | The unique ID of the campaign, for example "123456789", which is consistent with the campaign id from campaign list api. |
| `CAMPAIGN_NAME` | The name of the campaign. |
| `AD_ID` | The unique ID of the ad, for example "123456789". |
| `AD_NAME` | The name of the ad, which may not be unique. |
| `PLACEMENT_ID` | The vendor-specific unique ID of the app where the ad is placed. For example, com.goog.bar for Android and 123456789 for iOS apps. |
| `PLACEMENT_NAME` | The name of the app where the ad is placed. |
| `PLACEMENT_PLATFORM` | The platform of the app where the ad is placed. |
| `COUNTRY` | The name of the targeted country. |
| `FORMAT` | Format of the ad unit (for example, "banner", "native"), an ad delivery dimension. |

## Metric

The metrics of the campaign report.

| Enums ||
|---|---|
| `METRIC_UNSPECIFIED` | Default value for an unset field. Do not use. |
| `IMPRESSIONS` | The number of times an ad is shown to the user. |
| `CLICKS` | The number of times a user clicks an ad. |
| `CLICK_THROUGH_RATE` | The number of clicks an ad receives divided by the number of times the ad is shown. |
| `INSTALLS` | The number of times apps were downloaded to devices. |
| `ESTIMATED_COST` | The estimated cost of serving a campaign ad instead of an ad that earns revenue. The currency is the reporting currency for campaigns. |
| `AVERAGE_CPI` | The average cost per install. This means the average amount that was spent to acquire a new user. The currency is the reporting currency for campaigns. |
| `INTERACTIONS` | The number of times a user interacts with an ad. This consists of clicks and engagements. |