AdGroup

Contains the methods used to manage an ad group.

Methods

Method Name Return Type Description
addLocation(int locationId) TargetedLocationOperation Creates a location target in this ad group from a location ID.
addLocation(int locationId, double bidModifier) TargetedLocationOperation Creates a location target in this ad group from a location ID and bid modifier.
ads AdSelector Gets a selector used to filter the list of ads in this ad group.
applyLabel(string name) void Applies the label to this ad group.
bidding AdGroupBidding Gets the methods used to manage this ad group's bid amount.
enable void Enables this ad group.
excludeLocation(int locationId) ExcludedLocationOperation Creates a location exclusion in this ad group from a location ID.
getCampaign Campaign Gets the campaign that this ad group belongs to.
getEndDate BingAdsDate Gets the date when ads in this ad group stop serving.
getEntityType string Gets this entity's type.
getId string Gets the ID that uniquely identifies this ad group.
getName string Gets this ad group's name.
getStartDate BingAdsDate Get the date when ads in this ad group start serving.
getStats Stats Gets the performance data for this ad group.
isEnabled Boolean Gets a Boolean value that indicates whether this ad group is enabled.
isPaused Boolean Gets a Boolean value that indicates whether this ad group is paused.
isRemoved Boolean Gets a Boolean value that indicates whether this ad group is removed.
keywords KeywordSelector Gets a selector used to filter the list of keywords in this ad group.
labels LabelSelector Gets a selector used to filter the list of labels associated with this ad group.
newAd AdBuilderSpace Gets an object that contains methods for getting ad builders.
newKeywordBuilder KeywordBuilder Gets a builder used to add a keyword to this ad group.
pause void Pauses this ad group.
productGroups ProductGroupSelector Gets a selector used to filter the list of product groups in this ad group.
removeLabel(string name) void Removes the label from this ad group.
rootProductGroup ProductGroup Gets the root product group for this ad group.
setEndDate(string endDate) void Sets the date when ads in this ad group stop serving.
setEndDate(Object endDate) void Sets the date when ads in this ad group stop serving.
setName(String name) void Sets the ad group's name.
setStartDate(string startDate) void Sets the date when ads in this ad group begin serving.
setStartDate(Object startDate) void Sets the date when ads in this ad group begin serving.
targeting AdGroupTargeting Provides access to ad group level targeting criteria: location targeting.
urls AdGroupUrls Contains the methods used to manage this ad group's final URLs, tracking template, and custom parameters.

addLocation(int locationId)

Creates a location target in this ad group from a location ID.

Returns

Type Description
TargetedLocationOperation The operation object used to check whether the targeted location was successfully added.

addLocation(int locationId, double bidModifier)

Creates a location target in this ad group from a location ID and bid modifier.

Returns

Type Description
TargetedLocationOperation The operation object used to check whether the targeted location was successfully added.

ads

Gets a selector used to filter the list of ads in this ad group.

Returns

Type Description
AdSelector A selector used to filter the list of ads in this ad group.

applyLabel(string name)

Applies the label to the ad group.

You may apply a maximum of 50 labels to an ad group. 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.

bidding

Gets the methods used to manage this ad group's bid amount.

Returns:

Type Description
AdGroupBidding Contains the methods for managing this ad group's bid amount.

enable

Enables this ad group.

Returns

Type Description
void Returns nothing.

excludeLocation(int locationId)

Creates a location exclusion in this ad group from a location ID.

Returns

Type Description
ExcludedLocationOperation The operation object used to check whether the excluded location was successfully added.

getCampaign

Gets the campaign that this ad group belongs to.

Returns

Type Description
Campaign The campaign that this ad group belongs to.

getEndDate

Gets the date when ads in this ad group stop serving.

Returns

Type Description
BingAdsDate The date when ads in this ad group stop serving.

getEntityType

Gets this entity's type.

Returns

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

getId

Gets the ID that uniquely identifies this ad group.

Returns

Type Description
string The ID that uniquely identifies this ad group.

getName

Gets this ad group's name.

Returns

Type Description
string The name of this ad group.

getStartDate

Gets the date when ads in this ad group start serving.

Returns

Type Description
BingAdsDate The date when ads in this ad group start serving.

getStats

Gets the performance data for this ad group.

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

Returns:

Type Description
Stats The performance data for this ad group.

isEnabled

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

Returns:

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

isPaused

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

Returns:

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

isRemoved

Gets a Boolean value that indicates whether this ad group is removed (deleted).

Returns

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

keywords

Gets a selector used to filter the list of keywords in this ad group.

Returns

Type Description
KeywordSelector A selector used to filter the list of keywords in this ad group.

labels

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

Returns

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

newAd

Gets an object that contains methods for getting ad builders.

Returns

Type Description
AdBuilderSpace An object that contains methods for getting ad builders. For example, to build an expanded text ad, call the object's expandedTextAdBuilder method to get the ExpandedTextAdBuilder object.

newKeywordBuilder

Gets a builder used to add a keyword to this ad group.

Returns

Type Description
KeywordBuilder The builder used to add a keyword to this ad group.

pause

Pauses this ad group.

Returns

Type Description
void Returns nothing.

productGroups

Gets a selector used to filter the list of product groups in this ad group.

Returns

Type Description
ProductGroupSelector A selector used to filter the list of product groups in this ad group.

removeLabel(string name)

Removes the label from the ad group.

Arguments

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

Returns

Type Description
void Returns nothing.

rootProductGroup

Gets the root product group in this ad group.

Returns

Type Description
ProductGroup The root product group in this ad group. Returns null if the ad group doesn't contain product groups.

setEndDate(string endDate)

Sets the date when ads in this ad group stop serving. Set an end date only if you want ads in the group to stop serving on a specific date.

Arguments

Name Type Description
endDate string The date when ads in the ad group stop serving. Specify the date in the form, YYYYMMDD.

Returns

Type Description
void Returns nothing.

setEndDate(Object endDate)

Sets the date when ads in this ad group stop serving. Set an end date only if you want ads in the group to stop serving on a specific date.

Arguments

Name Type Description
endDate Object The date when ads in this ad group stop serving. Specify the date using an object with the following fields:
  • year
  • month
  • day
For example: var date = {year: 2018, month: 5, day: 13};

The month is one-based where 1 is January and 12 is December.

Returns

Type Description
void Returns nothing.

setName(string name)

Sets this ad group's name.

Arguments

Name Type Description
name string The name of this ad group. The name may contain a maximum of 256 characters and must be unique amongst all ad groups in the campaign.

Returns

Type Description
void Returns nothing.

setStartDate(string startDate)

Sets the date when ads in this ad group start serving. Set a start date only if you want ads in the group to start serving on a specific date; otherwise, they start serving immediately.

Arguments

Name Type Description
endDate string The date when ads in this ad group start serving. Specify the date in the form, YYYYMMDD.

Returns

Type Description
void Returns nothing.

setStartDate(Object startDate)

Sets the date when ads in this ad group start serving. Set a start date only if you want ads in the group to start serving on a specific date; otherwise, they start serving immediately.

Arguments

Name Type Description
endDate Object The date when ads in this ad group start serving. Specify the date using an object with the following fields:
  • year
  • month
  • day
For example: var date = {year: 2018, month: 5, day: 13};

The month is one-based where 1 is January and 12 is December.

Returns

Type Description
void Returns nothing.

targeting

Provides access to ad group level targeting criteria: location targeting.

Returns

Type Description
AdGroupTargeting Access to location targeting criteria in this ad group.

urls

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

Returns

Type Description
AdGroupUrls The object used to manage this ad group's final URLs, tracking template, and custom parameters.

See also