Accounts.adunits

An Ad Unit Resource represents a saved ad unit with a specific set of ad settings that you've customized within your account.

For a list of methods for this resource, see the end of this page.

Resource representations

An Ad Unit resource includes several identifying properties for the ad unit.

{
  "code": string,
  "id": string,
  "kind": "adsensehost#adUnit",
  "name": string,
  "status": string,
  "customStyle": {
    "kind": "adsensehost#adStyle",
    "colors": {
      "border": string,
      "title": string,
      "background": string,
      "text": string,
      "url": string
    },
    "corners": string,
    "font": {
      "family": string,
      "size": string
    }
  },
  "contentAdsSettings": {
    "type": string,
    "size": string,
    "backupOption": {
      "type": string,
      "color": string,
      "url": string
    }
  },
  "mobileContentAdsSettings": {
    "type": string,
    "size": string,
    "markupLanguage": string,
    "scriptingLanguage": string
  }
}
Property name Value Description Notes
code string Identity code of this ad unit, not necessarily unique across ad clients.
contentAdsSettings object Settings specific to content ads (AFC) and highend mobile content ads (AFMC - deprecated).
contentAdsSettings.backupOption object The backup option to be used in instances where no ad is available.
contentAdsSettings.backupOption.color string Color to use when type is set to COLOR. These are represented as six hexadecimal characters, similar to HTML color codes, but without the leading hash.
contentAdsSettings.backupOption.type string Type of the backup option.

Acceptable values are:
  • "BLANK"
  • "COLOR"
  • "URL"
contentAdsSettings.backupOption.url string URL to use when type is set to URL.
contentAdsSettings.size string Size of this ad unit. Size values are in the form SIZE_{width}_{height}.
contentAdsSettings.type string Type of this ad unit. Possible values are TEXT, TEXT_IMAGE, IMAGE and LINK.
customStyle nested object Custom style information specific to this ad unit.
customStyle.colors object The colors included in the style. These are represented as six hexadecimal characters, similar to HTML color codes, but without the leading hash.
customStyle.colors.background string The color of the ad background.
customStyle.colors.border string The color of the ad border.
customStyle.colors.text string The color of the ad text.
customStyle.colors.title string The color of the ad title.
customStyle.colors.url string The color of the ad url.
customStyle.corners string The style of the corners in the ad.

Acceptable values are:
  • "SLIGHTLY_ROUNDED"
  • "SQUARE"
  • "VERY_ROUNDED"
customStyle.font object The font which is included in the style.
customStyle.font.family string The family of the font.

Acceptable values are:
  • "ACCOUNT_DEFAULT_FAMILY"
  • "ADSENSE_DEFAULT_FAMILY"
  • "ARIAL"
  • "LORA"
  • "OPEN_SANS"
  • "OPEN_SANS_LIGHT"
  • "ROBOTO_LIGHT"
  • "SLABO_27"
  • "TIMES"
  • "UBUNTU_LIGHT"
  • "VERDANA"
customStyle.font.size string The size of the font.

Acceptable values are:
  • "ACCOUNT_DEFAULT_SIZE"
  • "ADSENSE_DEFAULT_SIZE"
  • "LARGE"
  • "MEDIUM"
  • "SMALL"
customStyle.kind string Kind this is, in this case adsensehost#adStyle.
id string Unique identifier of this ad unit. This should be considered an opaque identifier; it is not safe to rely on it being in any particular format.
kind string Kind of resource this is, in this case adsensehost#adUnit.
mobileContentAdsSettings object Settings specific to WAP mobile content ads (AFMC - deprecated).
mobileContentAdsSettings.markupLanguage string The markup language to use for this ad unit.

Acceptable values are:
  • "CHTML"
  • "WML"
  • "XHTML"
mobileContentAdsSettings.scriptingLanguage string The scripting language to use for this ad unit.

Acceptable values are:
  • "ASP"
  • "CGI"
  • "JSP"
  • "PHP"
mobileContentAdsSettings.size string Size of this ad unit.
mobileContentAdsSettings.type string Type of this ad unit.
name string Name of this ad unit.
status string Status of this ad unit.

Acceptable values are:
  • "ACTIVE"
  • "INACTIVE"
  • "NEW"

Methods

delete
Delete the specified ad unit from the specified publisher AdSense account.
get
Get the specified host ad unit in this AdSense account.
getAdCode
Get ad code for the specified ad unit, attaching the specified host custom channels.
insert
Insert the supplied ad unit into the specified publisher AdSense account.
list
List all ad units in the specified publisher's AdSense account.
patch
Update the supplied ad unit in the specified publisher AdSense account. This method supports patch semantics.
update
Update the supplied ad unit in the specified publisher AdSense account.