Ad

The base object that ads, such as expanded text ads, derive from.

This object also represents standard text ads. You may no longer create standard text ads but you may retrieve, pause, remove, and enable them. The following methods do not apply to derived objects and should not be called.

  • getDestinationUrl()
  • getDisplayUrl()
  • getHeadline()
  • isMobilePreferred()

Note

  • Upgrade your expanded text ads to responsive search ads by February 1, 2023. After this date, you will no longer be able to create new or edit existing expanded text ads. For more information, see About responsive search ads.
  • Existing expanded text ads will continue to serve, and you'll be able to view reports on their performance.
  • You'll still be able to pause, enable, or remove your expanded text ads. Otherwise, attempts to add or update expanded text ads will result in a CampaignServiceAdTypeInvalid error.
  • Learn more about this change.

Methods

Method Name Return Type Description
applyLabel(string name) void Applies the label to this ad.
asType AdViewSpace Contains the methods used to cast this ad to a specific ad type.
enable void Enables this ad.
getAdGroup AdGroup Gets the ad group that this ad belongs to.
getCampaign Campaign Gets the campaign that this ad belongs to.
getDescription string Gets this ad's copy text.
getDestinationUrl string Gets the URL of the webpage that the user is taken to when they click the ad.
getDisplayUrl string Gets the URL that's displayed in the ad.
getEntityType string Gets this entity's type.
getHeadline string Gets this ad's title.
getId string Gets the ID that uniquely identifies this ad.
getPolicyApprovalStatus string Gets this ad's editorial approval status.
getStats Stats Gets this ad's performance data.
getType string Gets this ad's derived type.
isEnabled boolean Gets a Boolean value that indicates whether this ad is enabled.
isMobilePreferred boolean Gets a Boolean value that indicates whether the preference is for this ad to be displayed on mobile devices or all devices.
isPaused Boolean Gets a Boolean value that indicates whether this ad is paused.
isType AdTypeSpace Contains the methods used to test if an ad is of the specified type.
labels LabelSelector Gets a selector used to filter the list of labels associated with this ad.
pause void Pauses this ad.
remove void Removes this ad.
removeLabel(string name) void Removes the label from this ad.
urls AdUrls Contains the methods used to get this ad's final URLs, tracking template, and custom parameters.

applyLabel(string name)

Applies the label to the ad.

You may apply a maximum of 50 labels to an ad. For an example that adds a label to an entity, see Using labels.

Arguments

Name Type Description
name string The label's case-sensitive name. To get a list of labels in this account that you can apply, see AdsApp.labels.

Returns

Type Description
void Returns nothing.

asType

Contains the methods used to cast this ad to a specific ad type.

Returns

Type Description
AdViewSpace Contains the methods used to cast this ad to a specific ad type.

enable

Enables this ad.

Returns

Type Description
void Returns nothing.

getAdGroup

Gets the ad group that this ad belongs to.

Returns

Type Description
AdGroup The ad group that this ad belongs to.

getCampaign

Gets the campaign that this ad belongs to.

Returns

Type Description
Campaign The campaign that this ad belongs to.

getDescription

Gets this ad's copy text.

Returns

Type Description
string The ad's copy text.

getDestinationUrl

Gets the URL of the webpage that the user is taken to when they click the ad.

Returns

Type Description
string The URL of the webpage that the user is taken to when they click the ad. Returns null if called from a derived object.

getDisplayUrl

Gets the URL that's displayed in the ad.

Returns

Type Description
string The URL that's displayed in the ad. Returns null if called from a derived object.

getEntityType

Gets this entity's type.

Returns

Type Description
string This entity's type, which is Ad.

getHeadline

Gets this ad's title.

Returns

Type Description
string The ad's title. Returns null if called from a derived object.

getId

Gets the ID that uniquely identifies this ad.

Returns

Type Description
string The ID that uniquely identifies this ad.

getPolicyApprovalStatus

Gets this ad's editorial approval status.

Returns

Type Description
string The ad's editorial approval status. The following are the possible values.
  • APPROVED
  • APPROVED_LIMITED
  • UNDER_REVIEW
  • DISAPPROVED

getStats

Gets this ad's performance data.

To call this method, you must include one of the forDateRange methods in the ad selector's chain.

Returns

Type Description
Stats The ad's performance data.

getType

Gets this ad's derived type.

Returns

Type Description
string This ad's derived type. The following are the possible types.
  • EXPANDED_TEXT_AD
.

isEnabled

Gets a Boolean value that indicates whether this ad is enabled.

Returns

Type Description
boolean Is true if this ad is enabled; otherwise, false.

isMobilePreferred

Gets a Boolean value that indicates whether the preference is for this ad to be displayed on mobile devices or all devices.

Returns

Type Description
boolean Is true if the preference is for this ad to be displayed on mobile devices. If false, the preference is for this ad to be displayed on all devices.

isPaused

Gets a Boolean value that indicates whether this ad is paused.

Returns

Type Description
Boolean Is true if this ad is paused; otherwise, false.

isType

Contains the methods used to test if an ad is of the specified type.

Returns

Type Description
AdTypeSpace Contains the methods used to test if an ad is of the specified type.

labels

Gets a selector used to filter the list of labels associated with this ad.

Returns

Type Description
LabelSelector A selector used to filter the list of labels associated with this ad.

pause

Pauses this ad.

Returns

Type Description
void Returns nothing.

remove

Removes this ad.

Returns

Type Description
void Returns nothing.

removeLabel(string name)

Removes the label from the ad.

Arguments

Name Type Description
name string The label's case-sensitive name. To get a list of labels associated with this ad, see labels.

Returns

Type Description
void Returns nothing.

urls

Contains the methods used to get this ad's final URLs, tracking template, and custom parameters.

Returns

Type Description
AdUrls The object used to get this ad's final URLs, tracking template, and custom parameters.

See also