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 \ V1Methods
__construct
Constructor.
Parameters | |
---|---|
Name | Description |
data |
array
Optional. Data for populating the Message object. |
↳ name |
string
Identifier. The resource name of the AdUnit. Format: |
↳ ad_unit_id |
int|string
Output only. 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<Google\Ads\AdManager\V1\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
Immutable. A string used to uniquely identify the ad unit for the purposes of serving the ad. This attribute is optional and 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 |
array
Optional. The resource names of Teams directly applied to this AdUnit. Format: "networks/{network_code}/teams/{team_id}" |
↳ teams |
array
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<Google\Ads\AdManager\V1\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<Google\Ads\AdManager\V1\AppliedLabel>
Optional. The set of labels applied directly to this ad unit. |
↳ effective_applied_labels |
array<Google\Ads\AdManager\V1\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 field is readonly and is assigned by Google. |
↳ applied_label_frequency_caps |
array<Google\Ads\AdManager\V1\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<Google\Ads\AdManager\V1\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. The smart size mode for this ad unit. This attribute is optional and defaults to SmartSizeMode.NONE for fixed sizes. |
↳ applied_adsense_enabled |
bool
Optional. The value of AdSense enabled directly applied to this ad unit. This attribute is optional and 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. |
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. AdUnit ID.
Returns | |
---|---|
Type | Description |
int|string |
setAdUnitId
Output only. 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 |
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\Internal\RepeatedField |
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<Google\Ads\AdManager\V1\AdUnitParent>
|
Returns | |
---|---|
Type | Description |
$this |
getDisplayName
Required. The display name of the ad unit. Its maximum length is 255 characters.
Returns | |
---|---|
Type | Description |
string |
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
Immutable. A string used to uniquely identify the ad unit for the purposes of serving the ad. This attribute is optional and 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 |
setAdUnitCode
Immutable. A string used to uniquely identify the ad unit for the purposes of serving the ad. This attribute is optional and 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 |
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 |
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 |
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\Internal\RepeatedField |
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\Internal\RepeatedField |
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 |
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 |
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 |
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\Internal\RepeatedField |
setAdUnitSizes
Optional. The sizes that can be served inside this ad unit.
Parameter | |
---|---|
Name | Description |
var |
array<Google\Ads\AdManager\V1\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 |
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\Internal\RepeatedField |
setAppliedLabels
Optional. The set of labels applied directly to this ad unit.
Parameter | |
---|---|
Name | Description |
var |
array<Google\Ads\AdManager\V1\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 field is readonly and is assigned by Google.
Returns | |
---|---|
Type | Description |
Google\Protobuf\Internal\RepeatedField |
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 field is readonly and is assigned by Google.
Parameter | |
---|---|
Name | Description |
var |
array<Google\Ads\AdManager\V1\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\Internal\RepeatedField |
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<Google\Ads\AdManager\V1\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\Internal\RepeatedField |
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<Google\Ads\AdManager\V1\LabelFrequencyCap>
|
Returns | |
---|---|
Type | Description |
$this |
getSmartSizeMode
Optional. The smart size mode for this ad unit. This attribute is optional and defaults to SmartSizeMode.NONE for fixed sizes.
Returns | |
---|---|
Type | Description |
int |
setSmartSizeMode
Optional. The smart size mode for this ad unit. This attribute is optional and 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.
This attribute is optional and 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.
This attribute is optional and 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 |
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 |