Metadata calls in the AdSense Management API allow developers to fetch the list of available dimensions and metrics, check compatibility between each other and find out what products are supported. A sample response might be:
{ "kind": "adsense#reportingMetadataEntry", "id": "EXAMPLE_DIMENSION", "compatibleDimensions": [ "1", "2", "4", ... ], "compatibleMetrics": [ "AD_REQUESTS", "AD_REQUESTS_COVERAGE", "AD_REQUESTS_CTR", ... ], "supportedProducts": [ "AFMC", "AFC", "AFV" ] }
The compatibleMetrics
field simply provides a list of metrics which are compatible with that dimension. This means that if you want to use a metric in your report, you'll need to make sure that it's compatible with all the dimensions you've requested.
Compatibility between dimensions is, however, a bit more complicated.
Understanding dimension compatibility
The compatibleDimensions
field shows a list where each item is an integer representing a group of compatible dimensions. As there is no one-to-one relation between compatible dimensions, they are represented as groups (as shown below).
Group #1 | Group #2 | Group #3 | Group #4 |
---|---|---|---|
AD_CLIENT_ID | AD_CLIENT_ID | AD_CLIENT_ID | AD_CLIENT_ID |
AD_FORMAT_CODE | AD_FORMAT_CODE | AD_FORMAT_CODE | AD_FORMAT_CODE |
AD_FORMAT_NAME | AD_FORMAT_NAME | AD_FORMAT_NAME | AD_FORMAT_NAME |
AD_UNIT_CODE | |||
AD_UNIT_ID | |||
AD_UNIT_NAME | |||
AD_UNIT_SIZE_CODE | |||
AD_UNIT_SIZE_NAME | |||
BID_TYPE_CODE | BID_TYPE_CODE | BID_TYPE_CODE | BID_TYPE_CODE |
BID_TYPE_NAME | BID_TYPE_NAME | BID_TYPE_NAME | BID_TYPE_NAME |
COUNTRY_CODE | COUNTRY_CODE | ||
COUNTRY_NAME | COUNTRY_NAME | ||
CUSTOM_CHANNEL_CODE | |||
CUSTOM_CHANNEL_ID | |||
CUSTOM_CHANNEL_NAME | |||
BUYER_NETWORK_ID | |||
BUYER_NETWORK_NAME | |||
DATE | DATE | DATE | DATE |
DOMAIN_NAME | |||
MONTH | MONTH | MONTH | MONTH |
PLATFORM_TYPE_CODE | PLATFORM_TYPE_CODE | PLATFORM_TYPE_CODE | PLATFORM_TYPE_CODE |
PLATFORM_TYPE_NAME | PLATFORM_TYPE_NAME | PLATFORM_TYPE_NAME | PLATFORM_TYPE_NAME |
PRODUCT_CODE | PRODUCT_CODE | PRODUCT_CODE | PRODUCT_CODE |
PRODUCT_NAME | PRODUCT_NAME | PRODUCT_NAME | PRODUCT_NAME |
TARGETING_TYPE_CODE | TARGETING_TYPE_CODE | TARGETING_TYPE_CODE | TARGETING_TYPE_CODE |
TARGETING_TYPE_NAME | TARGETING_TYPE_NAME | TARGETING_TYPE_NAME | TARGETING_TYPE_NAME |
WEEK | WEEK | WEEK | WEEK |
From the previous table, note that:
- DATE, MONTH and WEEK are compatible with every group.
- DOMAIN_NAME (Group #1) is not compatible with CUSTOM_CHANNEL_* (Group #4).
- If you want to report on ad units (Group #3) you won’t be able to use custom channels (Group #4) since a custom channel can be applied to one or more ad units.
- Country names (Groups #3 and #4) can be used in combination with ad units (Group #3) or custom channels (Group #4) but not both.