REST Resource: accounts.adclients.adunits
Stay organized with collections
Save and categorize content based on your preferences.
Resource: AdUnit
Representation of an ad unit. An ad unit represents a saved ad unit with a specific set of ad settings that have been customized within an account.
JSON representation |
{
"name": string,
"reportingDimensionId": string,
"displayName": string,
"state": enum (State ),
"contentAdsSettings": {
object (ContentAdsSettings )
}
} |
Fields |
name |
string
Output only. Resource name of the ad unit. Format: accounts/{account}/adclients/{adclient}/adunits/{adunit}
|
reportingDimensionId |
string
Output only. Unique ID of the ad unit as used in the AD_UNIT_ID reporting dimension.
|
displayName |
string
Required. Display name of the ad unit, as provided when the ad unit was created.
|
state |
enum (State )
Required. State of the ad unit.
|
contentAdsSettings |
object (ContentAdsSettings )
Required. Settings specific to content ads (AFC).
|
State
Enums |
STATE_UNSPECIFIED |
State unspecified. |
ACTIVE |
Ad unit has been activated by the user. |
ARCHIVED |
Ad unit has been archived by the user. Note that archived ad units are only removed from the default view in the UI. Archived ad units can still serve ads. |
ContentAdsSettings
Settings specific to content ads (AFC).
JSON representation |
{
"size": string,
"type": enum (Type )
} |
Fields |
size |
string
Required. Size of the ad unit. e.g. "728x90", "1x3" (for responsive ad units).
|
type |
enum (Type )
Required. Type of the ad unit.
|
Type
Content ads settings types supported by the api.
Enums |
TYPE_UNSPECIFIED |
Unspecified ad unit type. |
DISPLAY |
Display ad unit. |
FEED |
In-feed ad unit. |
ARTICLE |
In-article ad unit. |
MATCHED_CONTENT |
Matched content unit. |
LINK |
Link ad unit. Note that link ad units have now been retired, see https://support.google.com/adsense/answer/9987221. |
Methods |
|
Creates an ad unit. |
|
Gets an ad unit from a specified account and ad client. |
|
Gets the ad unit code for a given ad unit. |
|
Lists all ad units under a specified account and ad client. |
|
Lists all the custom channels available for an ad unit. |
|
Updates an ad unit. |
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-02-28 UTC.
[null,null,["Last updated 2025-02-28 UTC."],[[["\u003cp\u003eAd units represent saved ad settings customized within an AdSense account, including display name, state, and content ad settings.\u003c/p\u003e\n"],["\u003cp\u003eAd unit states include \u003ccode\u003eACTIVE\u003c/code\u003e (serving ads), \u003ccode\u003eARCHIVED\u003c/code\u003e (removed from default UI view but can still serve), and \u003ccode\u003eSTATE_UNSPECIFIED\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eContent ad settings define the ad size, and type (display, in-feed, in-article, matched content, or link, though link ads are deprecated).\u003c/p\u003e\n"],["\u003cp\u003eYou can manage ad units using methods like \u003ccode\u003ecreate\u003c/code\u003e, \u003ccode\u003eget\u003c/code\u003e, \u003ccode\u003egetAdcode\u003c/code\u003e, \u003ccode\u003elist\u003c/code\u003e, \u003ccode\u003elistLinkedCustomChannels\u003c/code\u003e, and \u003ccode\u003epatch\u003c/code\u003e.\u003c/p\u003e\n"]]],["Ad units are saved configurations with customized ad settings within an account. Key attributes include `name`, `reportingDimensionId`, `displayName`, `state` (ACTIVE or ARCHIVED), and `contentAdsSettings`. Content ad settings define the `size` and `type` (DISPLAY, FEED, ARTICLE, MATCHED_CONTENT, or LINK). Methods allow for the creation, retrieval, code retrieval, listing, listing of linked custom channels, and updating of ad units.\n"],null,["# REST Resource: accounts.adclients.adunits\n\n- [Resource: AdUnit](#AdUnit)\n - [JSON representation](#AdUnit.SCHEMA_REPRESENTATION)\n- [State](#State)\n- [ContentAdsSettings](#ContentAdsSettings)\n - [JSON representation](#ContentAdsSettings.SCHEMA_REPRESENTATION)\n- [Type](#Type)\n- [Methods](#METHODS_SUMMARY)\n\nResource: AdUnit\n----------------\n\nRepresentation of an ad unit. An ad unit represents a saved ad unit with a specific set of ad settings that have been customized within an account.\n\n| JSON representation |\n|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"name\": string, \"reportingDimensionId\": string, \"displayName\": string, \"state\": enum (/adsense/management/reference/rest/v2/accounts.adclients.adunits#State), \"contentAdsSettings\": { object (/adsense/management/reference/rest/v2/accounts.adclients.adunits#ContentAdsSettings) } } ``` |\n\n| Fields ||\n|------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `name` | `string` Output only. Resource name of the ad unit. Format: accounts/{account}/adclients/{adclient}/adunits/{adunit} |\n| `reportingDimensionId` | `string` Output only. Unique ID of the ad unit as used in the `AD_UNIT_ID` reporting dimension. |\n| `displayName` | `string` Required. Display name of the ad unit, as provided when the ad unit was created. |\n| `state` | `enum (`[State](/adsense/management/reference/rest/v2/accounts.adclients.adunits#State)`)` Required. State of the ad unit. |\n| `contentAdsSettings` | `object (`[ContentAdsSettings](/adsense/management/reference/rest/v2/accounts.adclients.adunits#ContentAdsSettings)`)` Required. Settings specific to content ads (AFC). |\n\nState\n-----\n\nState of an ad unit.\n\n| Enums ||\n|---------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `STATE_UNSPECIFIED` | State unspecified. |\n| `ACTIVE` | Ad unit has been activated by the user. |\n| `ARCHIVED` | Ad unit has been archived by the user. Note that archived ad units are only removed from the default view in the UI. Archived ad units can still serve ads. |\n\nContentAdsSettings\n------------------\n\nSettings specific to content ads (AFC).\n\n| JSON representation |\n|------------------------------------------------------------------------------------------------------------------|\n| ``` { \"size\": string, \"type\": enum (/adsense/management/reference/rest/v2/accounts.adclients.adunits#Type) } ``` |\n\n| Fields ||\n|--------|-------------------------------------------------------------------------------------------------------------------------|\n| `size` | `string` Required. Size of the ad unit. e.g. \"728x90\", \"1x3\" (for responsive ad units). |\n| `type` | `enum (`[Type](/adsense/management/reference/rest/v2/accounts.adclients.adunits#Type)`)` Required. Type of the ad unit. |\n\nType\n----\n\nContent ads settings types supported by the api.\n\n| Enums ||\n|--------------------|--------------------------------------------------------------------------------------------------------------------------------------------------|\n| `TYPE_UNSPECIFIED` | Unspecified ad unit type. |\n| `DISPLAY` | Display ad unit. |\n| `FEED` | In-feed ad unit. |\n| `ARTICLE` | In-article ad unit. |\n| `MATCHED_CONTENT` | Matched content unit. |\n| `LINK` | Link ad unit. Note that link ad units have now been retired, see \u003chttps://support.google.com/adsense/answer/9987221\u003e. | This item is deprecated! |\n\n| Methods ------- ||\n|---------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------|\n| ### [create](/adsense/management/reference/rest/v2/accounts.adclients.adunits/create) | Creates an ad unit. |\n| ### [get](/adsense/management/reference/rest/v2/accounts.adclients.adunits/get) | Gets an ad unit from a specified account and ad client. |\n| ### [getAdcode](/adsense/management/reference/rest/v2/accounts.adclients.adunits/getAdcode) | Gets the ad unit code for a given ad unit. |\n| ### [list](/adsense/management/reference/rest/v2/accounts.adclients.adunits/list) | Lists all ad units under a specified account and ad client. |\n| ### [listLinkedCustomChannels](/adsense/management/reference/rest/v2/accounts.adclients.adunits/listLinkedCustomChannels) | Lists all the custom channels available for an ad unit. |\n| ### [patch](/adsense/management/reference/rest/v2/accounts.adclients.adunits/patch) | Updates an ad unit. |"]]