AdsApp.​AdGroup

Represents a Google Ads ad group.

Methods:

MemberTypeDescription
adParams AdsApp.AdParamSelector Creates a selector of all ad params in the ad group.
addCallout AdsApp.CalloutOperation Adds a callout to this ad group.
addMobileApp AdsApp.MobileAppOperation Adds a mobile app to this ad group.
addPhoneNumber AdsApp.PhoneNumberOperation Adds a phone number to this ad group.
addPrice AdsApp.PriceOperation Adds a price extension to this ad group.
addSitelink AdsApp.SitelinkOperation Adds a sitelink to this ad group.
addSnippet AdsApp.SnippetOperation Adds a snippet to this ad group.
ads AdsApp.AdSelector Returns the selector of all ads in the ad group.
applyLabel void Applies a label to the ad group.
bidding AdsApp.AdGroupBidding Provides access to this ad group's bidding fields.
clearMobileBidModifier void Clears the mobile bid modifier for this ad group.
createNegativeKeyword void Creates a new negative keyword with the specified text.
devices AdsApp.AdGroupDevices Returns an AdGroupDevices instance associated with the ad group.
display AdsApp.AdGroupDisplay Provides access to this ad group's display criteria: Audience, ExcludedAudience, DisplayKeyword, ExcludedDisplayKeyword, Placement, ExcludedPlacement, Topic, and ExcludedTopic.
enable void Enables the ad group.
extensions AdsApp.AdGroupExtensions Provides access to this ad group's extensions: AdGroupCallout, AdGroupMobileApp, AdGroupPhoneNumber, AdGroupSitelink, and AdGroupSnippet.
getBaseAdGroup AdsApp.AdGroup Returns the base ad group to which this ad group belongs.
getBaseCampaign AdsApp.Campaign Returns the base campaign to which this ad group belongs.
getCampaign AdsApp.Campaign Returns the campaign to which this ad group belongs or null if it does not belong to a search or display campaign.
getEntityType String Returns the type of this entity as a String, in this case, "AdGroup".
getId String Returns the ID of the ad group.
getMobileBidModifier double Returns the mobile bid modifier for this ad group.
getName String Returns the name of the ad group.
getResourceName String Returns the resource name of the ad group.
getStatsFor AdsApp.Stats Returns stats for the specified date range.
getStatsFor AdsApp.Stats Returns stats for the specified custom date range.
isEnabled boolean Returns true if the ad group is enabled.
isPaused boolean Returns true if the ad group is paused.
isRemoved boolean Returns true if the ad group is removed.
keywords AdsApp.KeywordSelector Returns the selector of all keywords in the ad group.
labels AdsApp.LabelSelector Creates a selector of all labels applied to the ad group.
negativeKeywords AdsApp.NegativeKeywordSelector Returns a selector of all negative keywords in the ad group.
newAd AdsApp.AdBuilderSpace Returns a new ad builder space associated with this ad group.
newKeywordBuilder AdsApp.KeywordBuilder Returns a new keyword builder associated with this ad group.
pause void Pauses the ad group.
recommendations AdsApp.RecommendationSelector Returns the selector of all recommendations for this ad group.
removeCallout void Removes a callout extension from this ad group.
removeLabel void Removes a label from the ad group.
removeMobileApp void Removes a mobile app extension from this ad group.
removePhoneNumber void Removes a phone number extension from this ad group.
removePrice void Removes a price extension from this ad group.
removeSitelink void Removes a sitelink extension from this ad group.
removeSnippet void Removes a snippet extension from this ad group.
setMobileBidModifier void Sets the mobile bid modifier for this ad group to the specified value.
setName void Sets the name of the ad group.
targeting AdsApp.AdGroupTargeting Provides access to ad group-level targeting criteria: audiences.
urls AdsApp.AdGroupUrls Provides access to this ad group's URL fields.

adParams()

Creates a selector of all ad params in the ad group.

Return values:

TypeDescription
AdsApp.AdParamSelector Selector of all ad params in the ad group.

addCallout(calloutExtension)

Adds a callout to this ad group. See also Extensions.newCalloutBuilder()

Arguments:

NameTypeDescription
calloutExtension AdsApp.Callout The callout to add to this ad group.

Return values:

TypeDescription
AdsApp.CalloutOperation The associated callout operation.

addMobileApp(mobileAppExtension)

Adds a mobile app to this ad group. See also Extensions.newMobileAppBuilder()

Arguments:

NameTypeDescription
mobileAppExtension AdsApp.MobileApp The mobile app to add to this ad group.

Return values:

TypeDescription
AdsApp.MobileAppOperation The associated mobile app operation.

addPhoneNumber(phoneNumberExtension)

Adds a phone number to this ad group. See also Extensions.newPhoneNumberBuilder()

Arguments:

NameTypeDescription
phoneNumberExtension AdsApp.PhoneNumber The phone number to add to this ad group.

Return values:

TypeDescription
AdsApp.PhoneNumberOperation The associated phone number operation.

addPrice(priceExtension)

Adds a price extension to this ad group. See also Extensions.newPriceBuilder().

Arguments:

NameTypeDescription
priceExtension AdsApp.Price The price to add to this ad group.

Return values:

TypeDescription
AdsApp.PriceOperation The associated price operation.
Adds a sitelink to this ad group. See also Extensions.newSitelinkBuilder()

Arguments:

NameTypeDescription
sitelinkExtension AdsApp.Sitelink The sitelink to add to this ad group.

Return values:

TypeDescription
AdsApp.SitelinkOperation The associated sitelink operation.

addSnippet(snippetExtension)

Adds a snippet to this ad group. See also Extensions.newSnippetBuilder()

Arguments:

NameTypeDescription
snippetExtension AdsApp.Snippet The snippet to add to this ad group.

Return values:

TypeDescription
AdsApp.SnippetOperation The associated snippet operation.

ads()

Returns the selector of all ads in the ad group.

Return values:

TypeDescription
AdsApp.AdSelector The selector of all ads in the ad group.

applyLabel(name)

Applies a label to the ad group. name of the label is case-sensitive. Operation will fail if the label with the specified name does not already exist in the account.

Note that the ad group cannot have more than 50 labels.

Returns nothing.

Arguments:

NameTypeDescription
name String Name of the label to apply.

bidding()

Provides access to this ad group's bidding fields.

Return values:

TypeDescription
AdsApp.AdGroupBidding Access to this ad group's bidding fields.

clearMobileBidModifier()

Clears the mobile bid modifier for this ad group. By clearing this value, the ad group will use its campaign's mobile bid modifier (if one is set).

For more information about bid modifiers, please see the Google Ads Help Center article.

Returns nothing.

createNegativeKeyword(keywordText)

Creates a new negative keyword with the specified text.

Match type for the new negative keyword is specified as follows:

  • createNegativeKeyword("shoes") - broad match.
  • createNegativeKeyword("\"shoes\"") - phrase match.
  • createNegativeKeyword("[leather shoes]") - exact match.

Returns nothing.

Arguments:

NameTypeDescription
keywordText String The text of the new negative keyword.

devices()

Returns an AdGroupDevices instance associated with the ad group.

Return values:

TypeDescription
AdsApp.AdGroupDevices An AdGroupDevices instance associated with the ad group.

display()

Provides access to this ad group's display criteria: Audience, ExcludedAudience, DisplayKeyword, ExcludedDisplayKeyword, Placement, ExcludedPlacement, Topic, and ExcludedTopic.

Return values:

TypeDescription
AdsApp.AdGroupDisplay Access to this ad group's display criteria.

enable()

Enables the ad group.

Returns nothing.

extensions()

Provides access to this ad group's extensions: AdGroupCallout, AdGroupMobileApp, AdGroupPhoneNumber, AdGroupSitelink, and AdGroupSnippet.

Return values:

TypeDescription
AdsApp.AdGroupExtensions Access to this ad group's extensions.

getBaseAdGroup()

Returns the base ad group to which this ad group belongs.

Return values:

TypeDescription
AdsApp.AdGroup The base ad group to which this ad group belongs.

getBaseCampaign()

Returns the base campaign to which this ad group belongs.

Return values:

TypeDescription
AdsApp.Campaign The base campaign to which this ad group belongs.

getCampaign()

Returns the campaign to which this ad group belongs or null if it does not belong to a search or display campaign.

Return values:

TypeDescription
AdsApp.Campaign The campaign to which this ad group belongs or null if it does not belong to a search or display campaign.

getEntityType()

Returns the type of this entity as a String, in this case, "AdGroup".

Return values:

TypeDescription
String Type of this entity: "AdGroup".

getId()

Returns the ID of the ad group.

Return values:

TypeDescription
String The ID of the ad group.

getMobileBidModifier()

Returns the mobile bid modifier for this ad group.

The bid modifier is a multiplier applied to the ad group's bids on mobile devices. So, for instance, a bid modifier of 1.1 increases the bid to 110% of its original value, and changes a bid of $5.00 to $5.50.

Note that when you set a mobile bid modifier at both campaign- and ad group-level in a single campaign, the ad group mobile bid modifier will be used when determining your bid UNLESS the campaign mobile bid modifier is set to -1 (i.e. -100%) which will opt the entire campaign out of mobile regardless of any ad group mobile bid modifiers that may have been set.

For more information about bid modifiers, please see the Google Ads Help Center article.

Return values:

TypeDescription
double The mobile bid modifier.

getName()

Returns the name of the ad group.

Return values:

TypeDescription
String Name of the ad group.

getResourceName()

Returns the resource name of the ad group.

Return values:

TypeDescription
String The resource name of the ad group.

getStatsFor(dateRange)

Returns stats for the specified date range. Supported values:

TODAY, YESTERDAY, LAST_7_DAYS, THIS_WEEK_SUN_TODAY, LAST_WEEK, LAST_14_DAYS, LAST_30_DAYS, LAST_BUSINESS_WEEK, LAST_WEEK_SUN_SAT, THIS_MONTH, LAST_MONTH, ALL_TIME.

Example:

var stats = adGroup.getStatsFor("THIS_MONTH");

Arguments:

NameTypeDescription
dateRange String Date range for which the stats are requested.

Return values:

TypeDescription
AdsApp.Stats The stats for the specified date range.

getStatsFor(dateFrom, dateTo)

Returns stats for the specified custom date range. Both parameters can be either an object containing year, month, and day fields, or an 8-digit string in YYYYMMDD form. For instance, March 24th, 2013 is represented as either {year: 2013, month: 3, day: 24} or "20130324". The date range is inclusive on both ends, so forDateRange("20130324", "20130324") defines a range of a single day.

Arguments:

NameTypeDescription
dateFrom Object Start date of the date range. Must be either a string in YYYYMMDD form, or an object with year, month and day properties.
dateTo Object End date of the date range. Must be either a string in YYYYMMDD form, or an object with year, month and day properties.

Return values:

TypeDescription
AdsApp.Stats The stats for the specified date range.

isEnabled()

Returns true if the ad group is enabled.

Return values:

TypeDescription
boolean true if the ad group is enabled.

isPaused()

Returns true if the ad group is paused.

Return values:

TypeDescription
boolean true if the ad group is paused.

isRemoved()

Returns true if the ad group is removed.

Return values:

TypeDescription
boolean true if the ad group is removed.

keywords()

Returns the selector of all keywords in the ad group.

Return values:

TypeDescription
AdsApp.KeywordSelector The selector of all keywords in the ad group.

labels()

Creates a selector of all labels applied to the ad group.

Return values:

TypeDescription
AdsApp.LabelSelector Selector of all labels applied to the ad group.

negativeKeywords()

Returns a selector of all negative keywords in the ad group.

Return values:

TypeDescription
AdsApp.NegativeKeywordSelector The selector of all negative keywords in the ad group.

newAd()

Returns a new ad builder space associated with this ad group.

Return values:

TypeDescription
AdsApp.AdBuilderSpace A new ad builder space associated with this ad group.

newKeywordBuilder()

Returns a new keyword builder associated with this ad group.

Return values:

TypeDescription
AdsApp.KeywordBuilder A new keyword builder associated with this ad group.

pause()

Pauses the ad group.

Returns nothing.

recommendations()

Returns the selector of all recommendations for this ad group.

Return values:

TypeDescription
AdsApp.RecommendationSelector The selector of all recommendations for this ad group.

removeCallout(calloutExtension)

Removes a callout extension from this ad group.

Returns nothing.

Arguments:

NameTypeDescription
calloutExtension AdsApp.Callout The callout to remove from this ad group.

removeLabel(name)

Removes a label from the ad group. name of the label is case-sensitive. Operation will fail if the label with the specified name does not already exist in the account.

Returns nothing.

Arguments:

NameTypeDescription
name String Name of the label.

removeMobileApp(mobileAppExtension)

Removes a mobile app extension from this ad group.

Returns nothing.

Arguments:

NameTypeDescription
mobileAppExtension AdsApp.MobileApp The mobile app to remove from this ad group.

removePhoneNumber(phoneNumberExtension)

Removes a phone number extension from this ad group.

Returns nothing.

Arguments:

NameTypeDescription
phoneNumberExtension AdsApp.PhoneNumber The phone number to remove from this ad group.

removePrice(priceExtension)

Removes a price extension from this ad group.

Returns nothing.

Arguments:

NameTypeDescription
priceExtension AdsApp.Price The price to remove from this ad group.
Removes a sitelink extension from this ad group.

Returns nothing.

Arguments:

NameTypeDescription
sitelinkExtension AdsApp.Sitelink The sitelink to remove from this ad group.

removeSnippet(snippetExtension)

Removes a snippet extension from this ad group.

Returns nothing.

Arguments:

NameTypeDescription
snippetExtension AdsApp.Snippet The snippet to remove from this ad group.

setMobileBidModifier(modifier)

Sets the mobile bid modifier for this ad group to the specified value.

The bid modifier is a multiplier applied to the ad group's bids on mobile devices. So, for instance, a bid modifier of 1.1 increases the bid to 110% of its original value, and changes a bid of $5.00 to $5.50.

The operation will fail if the ad group's campaign has a mobile bid modifier of -1 (i.e. -100%). Setting a campaign mobile bid modifier to -1 will opt the entire campaign out of mobile.

Note that when you set a mobile bid modifier at both campaign- and ad group-level in a single campaign, the ad group mobile bid modifier will be used when determining your bid UNLESS the campaign mobile bid modifier is set to -1 (i.e. -100%) which will opt the entire campaign out of mobile regardless of any ad group mobile bid modifiers that may be set.

For more information about bid modifiers, please see the Google Ads Help Center article.

Returns nothing.

Arguments:

NameTypeDescription
modifier double The new mobile bid modifier.

setName(name)

Sets the name of the ad group.

Returns nothing.

Arguments:

NameTypeDescription
name String The new name for the ad group.

targeting()

Provides access to ad group-level targeting criteria: audiences. SearchAdGroupAudience, SearchAdGroupExcludedAudience,

Return values:

TypeDescription
AdsApp.AdGroupTargeting Access to certain kinds of targeting criteria in this ad group.

urls()

Provides access to this ad group's URL fields. See Using Upgraded URLs for more information.

Return values:

TypeDescription
AdsApp.AdGroupUrls Access to this ad group's URL fields.