0.17.0 (latest) 0.16.0 0.15.1 0.14.1 0.8.0 0.7.0 0.6.2 0.5.0 0.4.1 0.3.1 0.2.0 0.1.3 Reference documentation and code samples for the Google Ads Ad Manager V1 Client class AdUnit.

The AdUnit resource.

Generated from protobuf message `google.ads.admanager.v1.AdUnit`

## Namespace

Google \\ Ads \\ AdManager \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ name` | `string` Identifier. The resource name of the AdUnit. Format: `networks/{network_code}/adUnits/{ad_unit_id}` |
| `↳ ad_unit_id` | `int|string` Output only. Deprecated: AdUnit ID. |
| `↳ parent_ad_unit` | `string` Required. Immutable. The AdUnit's parent. Every ad unit has a parent except for the root ad unit, which is created by Google. Format: "networks/{network_code}/adUnits/{ad_unit_id}" |
| `↳ parent_path` | `array<AdUnitParent>` Output only. The path to this AdUnit in the ad unit hierarchy represented as a list from the root to this ad unit's parent. For root ad units, this list is empty. |
| `↳ display_name` | `string` Required. The display name of the ad unit. Its maximum length is 255 characters. |
| `↳ ad_unit_code` | `string` Optional. Immutable. A string used to uniquely identify the ad unit for the purposes of serving the ad. This attribute can be set during ad unit creation. If it is not provided, it will be assigned by Google based on the ad unit ID. |
| `↳ status` | `int` Output only. The status of this ad unit. It defaults to ACTIVE. |
| `↳ applied_target_window` | `int` Optional. The target window directly applied to this AdUnit. If this field is not set, this AdUnit uses the target window specified in effectiveTargetWindow. |
| `↳ effective_target_window` | `int` Output only. Non-empty default. The target window of this AdUnit. This value is inherited from ancestor AdUnits and defaults to TOP if no AdUnit in the hierarchy specifies it. |
| `↳ applied_teams` | `string[]` Optional. The resource names of Teams directly applied to this AdUnit. Format: "networks/{network_code}/teams/{team_id}" |
| `↳ teams` | `string[]` Output only. The resource names of all Teams that this AdUnit is on as well as those inherited from parent AdUnits. Format: "networks/{network_code}/teams/{team_id}" |
| `↳ description` | `string` Optional. A description of the ad unit. The maximum length is 65,535 characters. |
| `↳ explicitly_targeted` | `bool` Optional. If this field is set to true, then the AdUnit will not be implicitly targeted when its parent is. Traffickers must explicitly target such an AdUnit or else no line items will serve to it. This feature is only available for Ad Manager 360 accounts. |
| `↳ has_children` | `bool` Output only. This field is set to true if the ad unit has any children. |
| `↳ update_time` | `Google\Protobuf\Timestamp` Output only. The time this AdUnit was last modified. |
| `↳ ad_unit_sizes` | `array<AdUnitSize>` Optional. The sizes that can be served inside this ad unit. |
| `↳ external_set_top_box_channel_id` | `string` Optional. Determines what set top box video on demand channel this ad unit corresponds to in an external set top box ad campaign system. |
| `↳ refresh_delay` | `Google\Protobuf\Duration` Optional. The duration after which an Ad Unit will automatically refresh. This is only valid for ad units in mobile apps. If not set, the ad unit will not refresh. |
| `↳ applied_labels` | `array<AppliedLabel>` Optional. The set of labels applied directly to this ad unit. |
| `↳ effective_applied_labels` | `array<AppliedLabel>` Output only. Contains the set of labels applied directly to the ad unit as well as those inherited from the parent ad units. If a label has been negated, only the negated label is returned. This attribute is assigned by Google. |
| `↳ applied_label_frequency_caps` | `array<LabelFrequencyCap>` Optional. The set of label frequency caps applied directly to this ad unit. There is a limit of 10 label frequency caps per ad unit. |
| `↳ effective_label_frequency_caps` | `array<LabelFrequencyCap>` Output only. The label frequency caps applied directly to the ad unit as well as those inherited from parent ad units. |
| `↳ smart_size_mode` | `int` Optional. Non-empty default. The smart size mode for this ad unit. This attribute defaults to SmartSizeMode.NONE for fixed sizes. |
| `↳ applied_adsense_enabled` | `bool` Optional. The value of AdSense enabled directly applied to this ad unit. If not specified this ad unit will inherit the value of effectiveAdsenseEnabled from its ancestors. |
| `↳ effective_adsense_enabled` | `bool` Output only. Specifies whether or not the AdUnit is enabled for serving ads from the AdSense content network. This attribute defaults to the ad unit's parent or ancestor's setting if one has been set. If no ancestor of the ad unit has set appliedAdsenseEnabled, the attribute is defaulted to true. |
| `↳ refresh_rate_type` | `int` Optional. Non-empty default. Defines the type of refresh rate control for this ad unit. This field defaults to `DISABLED`. |

### getName

Identifier. The resource name of the AdUnit.

Format: `networks/{network_code}/adUnits/{ad_unit_id}`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setName

Identifier. The resource name of the AdUnit.

Format: `networks/{network_code}/adUnits/{ad_unit_id}`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getAdUnitId

Output only. Deprecated: AdUnit ID.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int|string` |   |

### setAdUnitId

Output only. Deprecated: AdUnit ID.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int|string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getParentAdUnit

Required. Immutable. The AdUnit's parent. Every ad unit has a parent except
for the root ad unit, which is created by Google. Format:
"networks/{network_code}/adUnits/{ad_unit_id}"

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### hasParentAdUnit

### clearParentAdUnit

### setParentAdUnit

Required. Immutable. The AdUnit's parent. Every ad unit has a parent except
for the root ad unit, which is created by Google. Format:
"networks/{network_code}/adUnits/{ad_unit_id}"

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getParentPath

Output only. The path to this AdUnit in the ad unit hierarchy represented
as a list from the root to this ad unit's parent. For root ad units, this
list is empty.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Google\Protobuf\RepeatedField<AdUnitParent>` |   |

### setParentPath

Output only. The path to this AdUnit in the ad unit hierarchy represented
as a list from the root to this ad unit's parent. For root ad units, this
list is empty.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<AdUnitParent>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getDisplayName

Required. The display name of the ad unit. Its maximum length is 255
characters.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### hasDisplayName

### clearDisplayName

### setDisplayName

Required. The display name of the ad unit. Its maximum length is 255
characters.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getAdUnitCode

Optional. Immutable. A string used to uniquely identify the ad unit for the
purposes of serving the ad. This attribute can be set during ad unit
creation. If it is not provided, it will be assigned by Google based on the
ad unit ID.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### hasAdUnitCode

### clearAdUnitCode

### setAdUnitCode

Optional. Immutable. A string used to uniquely identify the ad unit for the
purposes of serving the ad. This attribute can be set during ad unit
creation. If it is not provided, it will be assigned by Google based on the
ad unit ID.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getStatus

Output only. The status of this ad unit. It defaults to ACTIVE.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### hasStatus

### clearStatus

### setStatus

Output only. The status of this ad unit. It defaults to ACTIVE.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getAppliedTargetWindow

Optional. The target window directly applied to this AdUnit.

If this field is not set, this AdUnit uses the target window specified in
effectiveTargetWindow.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### hasAppliedTargetWindow

### clearAppliedTargetWindow

### setAppliedTargetWindow

Optional. The target window directly applied to this AdUnit.

If this field is not set, this AdUnit uses the target window specified in
effectiveTargetWindow.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getEffectiveTargetWindow

Output only. Non-empty default. The target window of this AdUnit. This
value is inherited from ancestor AdUnits and defaults to TOP if no AdUnit
in the hierarchy specifies it.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### hasEffectiveTargetWindow

### clearEffectiveTargetWindow

### setEffectiveTargetWindow

Output only. Non-empty default. The target window of this AdUnit. This
value is inherited from ancestor AdUnits and defaults to TOP if no AdUnit
in the hierarchy specifies it.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getAppliedTeams

Optional. The resource names of Teams directly applied to this AdUnit.

Format: "networks/{network_code}/teams/{team_id}"

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Google\Protobuf\RepeatedField<string>` |   |

### setAppliedTeams

Optional. The resource names of Teams directly applied to this AdUnit.

Format: "networks/{network_code}/teams/{team_id}"

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string[]` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getTeams

Output only. The resource names of all Teams that this AdUnit is on as well
as those inherited from parent AdUnits. Format:
"networks/{network_code}/teams/{team_id}"

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Google\Protobuf\RepeatedField<string>` |   |

### setTeams

Output only. The resource names of all Teams that this AdUnit is on as well
as those inherited from parent AdUnits. Format:
"networks/{network_code}/teams/{team_id}"

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string[]` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getDescription

Optional. A description of the ad unit. The maximum length is 65,535
characters.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### hasDescription

### clearDescription

### setDescription

Optional. A description of the ad unit. The maximum length is 65,535
characters.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getExplicitlyTargeted

Optional. If this field is set to true, then the AdUnit will not be
implicitly targeted when its parent is. Traffickers must explicitly
target such an AdUnit or else no line items will serve to it. This
feature is only available for Ad Manager 360 accounts.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### hasExplicitlyTargeted

### clearExplicitlyTargeted

### setExplicitlyTargeted

Optional. If this field is set to true, then the AdUnit will not be
implicitly targeted when its parent is. Traffickers must explicitly
target such an AdUnit or else no line items will serve to it. This
feature is only available for Ad Manager 360 accounts.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `bool` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getHasChildren

Output only. This field is set to true if the ad unit has any children.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### hasHasChildren

### clearHasChildren

### setHasChildren

Output only. This field is set to true if the ad unit has any children.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `bool` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getUpdateTime

Output only. The time this AdUnit was last modified.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Google\Protobuf\Timestamp|null` |   |

### hasUpdateTime

### clearUpdateTime

### setUpdateTime

Output only. The time this AdUnit was last modified.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `Google\Protobuf\Timestamp` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getAdUnitSizes

Optional. The sizes that can be served inside this ad unit.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Google\Protobuf\RepeatedField<AdUnitSize>` |   |

### setAdUnitSizes

Optional. The sizes that can be served inside this ad unit.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<AdUnitSize>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getExternalSetTopBoxChannelId

Optional. Determines what set top box video on demand channel this ad unit
corresponds to in an external set top box ad campaign system.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### hasExternalSetTopBoxChannelId

### clearExternalSetTopBoxChannelId

### setExternalSetTopBoxChannelId

Optional. Determines what set top box video on demand channel this ad unit
corresponds to in an external set top box ad campaign system.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getRefreshDelay

Optional. The duration after which an Ad Unit will automatically refresh.

This is only valid for ad units in mobile apps. If not set, the ad unit
will not refresh.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Google\Protobuf\Duration|null` |   |

### hasRefreshDelay

### clearRefreshDelay

### setRefreshDelay

Optional. The duration after which an Ad Unit will automatically refresh.

This is only valid for ad units in mobile apps. If not set, the ad unit
will not refresh.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `Google\Protobuf\Duration` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getAppliedLabels

Optional. The set of labels applied directly to this ad unit.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Google\Protobuf\RepeatedField<AppliedLabel>` |   |

### setAppliedLabels

Optional. The set of labels applied directly to this ad unit.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<AppliedLabel>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getEffectiveAppliedLabels

Output only. Contains the set of labels applied directly to the ad unit as
well as those inherited from the parent ad units. If a label has been
negated, only the negated label is returned. This attribute is assigned by
Google.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Google\Protobuf\RepeatedField<AppliedLabel>` |   |

### setEffectiveAppliedLabels

Output only. Contains the set of labels applied directly to the ad unit as
well as those inherited from the parent ad units. If a label has been
negated, only the negated label is returned. This attribute is assigned by
Google.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<AppliedLabel>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getAppliedLabelFrequencyCaps

Optional. The set of label frequency caps applied directly to this ad unit.

There is a limit of 10 label frequency caps per ad unit.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Google\Protobuf\RepeatedField<LabelFrequencyCap>` |   |

### setAppliedLabelFrequencyCaps

Optional. The set of label frequency caps applied directly to this ad unit.

There is a limit of 10 label frequency caps per ad unit.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<LabelFrequencyCap>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getEffectiveLabelFrequencyCaps

Output only. The label frequency caps applied directly to the ad unit as
well as those inherited from parent ad units.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Google\Protobuf\RepeatedField<LabelFrequencyCap>` |   |

### setEffectiveLabelFrequencyCaps

Output only. The label frequency caps applied directly to the ad unit as
well as those inherited from parent ad units.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<LabelFrequencyCap>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getSmartSizeMode

Optional. Non-empty default. The smart size mode for this ad unit. This
attribute defaults to SmartSizeMode.NONE for fixed sizes.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### hasSmartSizeMode

### clearSmartSizeMode

### setSmartSizeMode

Optional. Non-empty default. The smart size mode for this ad unit. This
attribute defaults to SmartSizeMode.NONE for fixed sizes.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getAppliedAdsenseEnabled

Optional. The value of AdSense enabled directly applied to this ad unit. If
not specified this ad unit will inherit the value of
effectiveAdsenseEnabled from its ancestors.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### hasAppliedAdsenseEnabled

### clearAppliedAdsenseEnabled

### setAppliedAdsenseEnabled

Optional. The value of AdSense enabled directly applied to this ad unit. If
not specified this ad unit will inherit the value of
effectiveAdsenseEnabled from its ancestors.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `bool` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getEffectiveAdsenseEnabled

Output only. Specifies whether or not the AdUnit is enabled for serving ads
from the AdSense content network. This attribute defaults to the ad unit's
parent or ancestor's setting if one has been set. If no ancestor of the ad
unit has set appliedAdsenseEnabled, the attribute is defaulted to true.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### hasEffectiveAdsenseEnabled

### clearEffectiveAdsenseEnabled

### setEffectiveAdsenseEnabled

Output only. Specifies whether or not the AdUnit is enabled for serving ads
from the AdSense content network. This attribute defaults to the ad unit's
parent or ancestor's setting if one has been set. If no ancestor of the ad
unit has set appliedAdsenseEnabled, the attribute is defaulted to true.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `bool` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getRefreshRateType

Optional. Non-empty default. Defines the type of refresh rate control for
this ad unit. This field defaults to `DISABLED`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### hasRefreshRateType

### clearRefreshRateType

### setRefreshRateType

Optional. Non-empty default. Defines the type of refresh rate control for
this ad unit. This field defaults to `DISABLED`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |