type AdUnitSize (v202408)
Stay organized with collections
Save and categorize content based on your preferences.
An AdUnitSize
represents the size of an ad in an ad unit. This also represents the
environment and companions of a particular ad in an ad unit. In most cases, it is a simple size
with just a width and a height (sometimes representing an aspect ratio).
- Namespace
-
https://www.google.com/apis/ads/publisher/v202408
Field
|
size
|
Size
The permissible creative size that can be served inside this ad unit.
|
environmentType
|
EnvironmentType
The environment type of the ad unit size. The default value is EnvironmentType.BROWSER.
Enumerations
-
BROWSER
- A regular web browser.
-
VIDEO_PLAYER
- Video players.
|
companions
|
AdUnitSize[]
The companions for this ad unit size. Companions are only valid if the environment is EnvironmentType.VIDEO_PLAYER. If the environment is EnvironmentType.BROWSER including
companions results in an error.
|
fullDisplayString
|
xsd:string
The full (including companion sizes, if applicable) display string of the size, e.g. "300x250" or "300x250v (180x150)"
|
isAudio
|
xsd:boolean
Whether the inventory size is audio. If set to true, Size will be set to "1x1"
and EnvironmentType will be set to EnvironmentType.VIDEO_PLAYER regardless of
user input.
|
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-08-06 UTC.
[null,null,["Last updated 2025-08-06 UTC."],[[["\u003cp\u003e\u003ccode\u003eAdUnitSize\u003c/code\u003e defines the dimensions of an ad within an ad unit, encompassing its width, height, and potential companions.\u003c/p\u003e\n"],["\u003cp\u003eIt specifies the environment type, which is typically a browser or video player, influencing how ads are displayed.\u003c/p\u003e\n"],["\u003cp\u003eCompanions, if applicable, are additional ad units associated with the main ad unit, relevant for video player environments.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003efullDisplayString\u003c/code\u003e offers a comprehensive representation of the ad unit size, including companion sizes when present.\u003c/p\u003e\n"],["\u003cp\u003eAudio inventory is designated by setting \u003ccode\u003eisAudio\u003c/code\u003e to true, resulting in a \u003ccode\u003e1x1\u003c/code\u003e size and a video player environment.\u003c/p\u003e\n"]]],["`AdUnitSize` defines the dimensions and environment of ads within an ad unit. Key attributes include `size` (creative dimensions), `environmentType` (e.g., BROWSER, VIDEO_PLAYER), and `companions` (other sizes for video ads). The `fullDisplayString` field provides a complete size representation. The service `InventoryService` and the method `getAdUnitSizesByStatement()` are used to deal with the AdUnitSize. The field `isAudio` indicates if the inventory size is audio.\n"],null,["# type AdUnitSize (v202408)\n\n**Service** \n**InventoryService** [SuggestedAdUnitService](/ad-manager/api/reference/v202408/SuggestedAdUnitService.AdUnitSize) **Dependencies** \n[AdUnit](/ad-manager/api/reference/v202408/InventoryService.AdUnit) [AdUnitSize](/ad-manager/api/reference/v202408/InventoryService.AdUnitSize) [getAdUnitSizesByStatement()](/ad-manager/api/reference/v202408/InventoryService#getAdUnitSizesByStatement) \n▼\n**AdUnitSize**\n\nAn `AdUnitSize` represents the size of an ad in an ad unit. This also represents the\nenvironment and companions of a particular ad in an ad unit. In most cases, it is a simple size\nwith just a width and a height (sometimes representing an aspect ratio).\n\n*** ** * ** ***\n\nNamespace\n:\n `https://www.google.com/apis/ads/publisher/v202408`\n\n| Field ----- ||\n|-------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ### `size` | ` `[Size](/ad-manager/api/reference/v202408/InventoryService.Size)` ` The permissible creative size that can be served inside this ad unit. |\n| ### `environmentType` | ` `[EnvironmentType](/ad-manager/api/reference/v202408/InventoryService.EnvironmentType)` ` The environment type of the ad unit size. The default value is [EnvironmentType.BROWSER](/ad-manager/api/reference/v202408/InventoryService.EnvironmentType#BROWSER). *** ** * ** *** **Enumerations** `BROWSER` : A regular web browser. `VIDEO_PLAYER` : Video players. \u003cbr /\u003e |\n| ### `companions` | ` `[AdUnitSize](/ad-manager/api/reference/v202408/InventoryService.AdUnitSize)`[]` The companions for this ad unit size. Companions are only valid if the environment is [EnvironmentType.VIDEO_PLAYER](/ad-manager/api/reference/v202408/InventoryService.EnvironmentType#VIDEO_PLAYER). If the environment is [EnvironmentType.BROWSER](/ad-manager/api/reference/v202408/InventoryService.EnvironmentType#BROWSER) including companions results in an error. |\n| ### `fullDisplayString` | ` `xsd:`string` The full (including companion sizes, if applicable) display string of the size, e.g. `\"300x250\"` or `\"300x250v (180x150)\"` |\n| ### `isAudio` | ` `xsd:`boolean` Whether the inventory size is audio. If set to true, `Size` will be set to `\"1x1\"` and `EnvironmentType` will be set to [EnvironmentType.VIDEO_PLAYER](/ad-manager/api/reference/v202408/InventoryService.EnvironmentType#VIDEO_PLAYER) regardless of user input. |"]]