AdsApp.CampaignTargeting
Stay organized with collections
Save and categorize content based on your preferences.
outlined_flag
Access and manage campaign-level targeting criteria, including device targeting, ad scheduling, location targeting, and audiences.
Utilize methods like adSchedules()
, audiences()
, and targetedLocations()
to retrieve specific targeting criteria.
Control targeting settings with getTargetingSetting()
and setTargetingSetting()
for criterion type groups.
Exclude audiences at the campaign level using newUserListBuilder()
and exclude()
.
Leverage the provided code example to interact with and modify campaign targeting settings programmatically.
Provides access to campaign-level targeting criteria: device targeting, ad
scheduling, location targeting, and audiences.
For instance, to select all locations targeted by a campaign you might
use:
var campaign = AdsApp . campaigns () . get () . next ();
var locations = campaign . targeting () . targetedLocations () . get ();
while ( locations . hasNext ()) {
var location = locations . next ();
}
Methods:
adSchedules()
Specializes this selector to return
AdSchedule criteria.
Return values:
audiences()
Specializes this selector to return
SearchCampaignAudience
criteria.
Return values:
excludedAudiences()
Specializes this selector to return
SearchCampaignExcludedAudience
criteria.
Return values:
excludedContentLabels()
Specializes this selector to return
ExcludedContentLabel criteria.
Return values:
excludedLocations()
Specializes this selector to return
ExcludedLocation criteria.
Return values:
getTargetingSetting(criterionTypeGroup)
Returns the current targeting setting of the specified criterion type group
for this campaign.
Currently the only supported criterion type group value is
'USER_INTEREST_AND_LIST'.
The returned setting will be either 'TARGET_ALL_TRUE' or
'TARGET_ALL_FALSE', corresponding to 'Bid only' and 'Target and bid',
respectively.
Arguments:
Name Type Description
criterionTypeGroup
String
The criterion type group to check.
Return values:
Type Description
String
The targeting setting for the criterion type group, either
'TARGET_ALL_TRUE' or 'TARGET_ALL_FALSE'.
languages()
Specializes this selector to return
Language criteria.
Return values:
newUserListBuilder()
Returns a new user list audience builder for this campaign. When
SearchCampaignAudienceBuilder.exclude()
is called, an excluded audience will be added in this campaign. Only
exclusions are available at campaign-level.
Return values:
Specializes this selector to return
Platform criteria.
Return values:
setTargetingSetting(criterionTypeGroup, targetingSetting)
Sets the targeting setting for this campaign.
Currently the targeting setting may be set for
USER_INTEREST_AND_LIST
criterion type group only.
Returns nothing.
Arguments:
Name Type Description
criterionTypeGroup
String
The criterion type group to receive the new
setting.
targetingSetting
String
The new targeting setting, either 'TARGET_ALL_TRUE'
or 'TARGET_ALL_FALSE'.
targetedLocations()
Specializes this selector to return
TargetedLocation criteria.
Return values:
targetedProximities()
Specializes this selector to return
TargetedProximity criteria.
Return values: