Represents a Google Ads ad group.
Methods:
Member Type Description
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:
addCallout(calloutExtension)
Adds a callout to this ad group. See also
Extensions.newCalloutBuilder() Arguments:
Name Type Description
calloutExtension
AdsApp.Callout
The callout to add to this ad group.
Return values:
addMobileApp(mobileAppExtension)
Adds a mobile app to this ad group. See also
Extensions.newMobileAppBuilder() Arguments:
Name Type Description
mobileAppExtension
AdsApp.MobileApp
The mobile app to add to this ad group.
Return values:
addPhoneNumber(phoneNumberExtension)
Adds a phone number to this ad group. See also
Extensions.newPhoneNumberBuilder() Arguments:
Name Type Description
phoneNumberExtension
AdsApp.PhoneNumber
The phone number to add to this ad group.
Return values:
addPrice(priceExtension)
Adds a price extension to this ad group. See also
Extensions.newPriceBuilder() .
Arguments:
Name Type Description
priceExtension
AdsApp.Price
The price to add to this ad group.
Return values:
addSitelink(sitelinkExtension)
Adds a sitelink to this ad group. See also
Extensions.newSitelinkBuilder() Arguments:
Name Type Description
sitelinkExtension
AdsApp.Sitelink
The sitelink to add to this ad group.
Return values:
addSnippet(snippetExtension)
Adds a snippet to this ad group. See also
Extensions.newSnippetBuilder() Arguments:
Name Type Description
snippetExtension
AdsApp.Snippet
The snippet to add to this ad group.
Return values:
ads()
Returns the selector of all ads in the ad group.
Return values:
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:
Name Type Description
name
String
Name of the label to apply.
bidding()
Provides access to this ad group's bidding fields.
Return values:
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 . Deprecated. Google Ads Scripts now supports desktop and tablet ad group bid
modifiers in addition to mobile. This functionality is available in the
AdGroupDevices class,
accessible via the AdGroup.devices method.
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:
Name Type Description
keywordText
String
The text of the new negative keyword.
devices()
Returns an
AdGroupDevices instance
associated with the ad group.
Return values:
display()
Provides access to this ad group's display criteria:
Audience ,
ExcludedAudience ,
DisplayKeyword ,
ExcludedDisplayKeyword ,
Placement ,
ExcludedPlacement ,
Topic , and
ExcludedTopic .
Return values:
enable()
Enables the ad group.
Returns nothing.
extensions()
Provides access to this ad group's extensions:
AdGroupCallout ,
AdGroupMobileApp ,
AdGroupPhoneNumber ,
AdGroupSitelink , and
AdGroupSnippet .
Return values:
getBaseAdGroup()
Returns the base ad group to which this ad group belongs.
Return values:
Type Description
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:
Type Description
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:
Type Description
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:
Type Description
String
Type of this entity: "AdGroup"
.
getId()
Returns the ID of the ad group.
Return values:
Type Description
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 . Deprecated. Google Ads Scripts now supports desktop and tablet ad group bid
modifiers in addition to mobile. This functionality is available in the
AdGroupDevices class,
accessible via the AdGroup.devices method.
Return values:
Type Description
double
The mobile bid modifier.
getName()
Returns the name of the ad group.
Return values:
Type Description
String
Name of the ad group.
getResourceName()
Returns the resource name of the ad group.
Return values:
Type Description
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:
Name Type Description
dateRange
String
Date range for which the stats are requested.
Return values:
Type Description
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:
Name Type Description
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:
Type Description
AdsApp.Stats
The stats for the specified date range.
isEnabled()
Returns
true
if the ad group is enabled.
Return values:
Type Description
boolean
true
if the ad group is enabled.
isPaused()
Returns
true
if the ad group is paused.
Return values:
Type Description
boolean
true
if the ad group is paused.
isRemoved()
Returns
true
if the ad group is removed.
Return values:
Type Description
boolean
true
if the ad group is removed.
keywords()
Returns the selector of all keywords in the ad group.
Return values:
labels()
Creates a selector of all labels applied to the ad group.
Return values:
negativeKeywords()
Returns a selector of all negative keywords in the ad group.
Return values:
newAd()
Returns a new ad builder space associated with this ad group.
Return values:
newKeywordBuilder()
Returns a new keyword builder associated with this ad group.
Return values:
pause()
Pauses the ad group.
Returns nothing.
recommendations()
Returns the selector of all recommendations for this ad group.
Return values:
removeCallout(calloutExtension)
Removes a callout extension from this ad group.
Returns nothing.
Arguments:
Name Type Description
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:
Name Type Description
name
String
Name of the label.
removeMobileApp(mobileAppExtension)
Removes a mobile app extension from this ad group.
Returns nothing.
Arguments:
Name Type Description
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:
Name Type Description
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:
Name Type Description
priceExtension
AdsApp.Price
The price to remove from this ad group.
removeSitelink(sitelinkExtension)
Removes a sitelink extension from this ad group.
Returns nothing.
Arguments:
Name Type Description
sitelinkExtension
AdsApp.Sitelink
The sitelink to remove from this ad group.
removeSnippet(snippetExtension)
Removes a snippet extension from this ad group.
Returns nothing.
Arguments:
Name Type Description
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 . Deprecated. Google Ads Scripts now supports desktop and tablet ad group bid
modifiers in addition to mobile. This functionality is available in the
AdGroupDevices class,
accessible via the AdGroup.devices method.
Returns nothing.
Arguments:
Name Type Description
modifier
double
The new mobile bid modifier.
setName(name)
Sets the name of the ad group.
Returns nothing.
Arguments:
Name Type Description
name
String
The new name for the ad group.
targeting()
Provides access to ad group-level targeting criteria: audiences.
SearchAdGroupAudience ,
SearchAdGroupExcludedAudience ,
Return values:
urls()
Provides access to this ad group's URL fields. See
Using Upgraded
URLs for more information.
Return values: