Metadata for Dimensions and Metrics

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 #1Group #2Group #3Group #4
AD_CLIENT_IDAD_CLIENT_IDAD_CLIENT_IDAD_CLIENT_ID
AD_FORMAT_CODEAD_FORMAT_CODEAD_FORMAT_CODEAD_FORMAT_CODE
AD_FORMAT_NAMEAD_FORMAT_NAMEAD_FORMAT_NAMEAD_FORMAT_NAME
AD_UNIT_CODE
AD_UNIT_ID
AD_UNIT_NAME
AD_UNIT_SIZE_CODE
AD_UNIT_SIZE_NAME
BID_TYPE_CODEBID_TYPE_CODEBID_TYPE_CODEBID_TYPE_CODE
BID_TYPE_NAMEBID_TYPE_NAMEBID_TYPE_NAMEBID_TYPE_NAME
COUNTRY_CODECOUNTRY_CODE
COUNTRY_NAMECOUNTRY_NAME
CUSTOM_CHANNEL_CODE
CUSTOM_CHANNEL_ID
CUSTOM_CHANNEL_NAME
BUYER_NETWORK_ID
BUYER_NETWORK_NAME
DATEDATEDATEDATE
DOMAIN_NAME
MONTHMONTHMONTHMONTH
PLATFORM_TYPE_CODEPLATFORM_TYPE_CODEPLATFORM_TYPE_CODEPLATFORM_TYPE_CODE
PLATFORM_TYPE_NAMEPLATFORM_TYPE_NAMEPLATFORM_TYPE_NAMEPLATFORM_TYPE_NAME
PRODUCT_CODEPRODUCT_CODEPRODUCT_CODEPRODUCT_CODE
PRODUCT_NAMEPRODUCT_NAMEPRODUCT_NAMEPRODUCT_NAME
TARGETING_TYPE_CODETARGETING_TYPE_CODETARGETING_TYPE_CODETARGETING_TYPE_CODE
TARGETING_TYPE_NAMETARGETING_TYPE_NAMETARGETING_TYPE_NAMETARGETING_TYPE_NAME
WEEKWEEKWEEKWEEK

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.

Next steps

Send feedback about...

AdSense Management API
AdSense Management API