AdsApp.ShoppingCampaignTargeting
Stay organized with collections
Save and categorize content based on your preferences.
Access to campaign-level targeting criteria.
For instance, to select all locations targeted by a campaign you might
use:
var campaign = AdsApp.shoppingCampaigns().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
ShoppingCampaignAudience
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'. |
newUserListBuilder()
Returns a new user list audience builder for this campaign. When
ShoppingCampaignAudienceBuilder.build()
is called, an audience will be added in this campaign.
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:
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-09-03 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-03 UTC."],[[["\u003cp\u003eAccess and manage campaign-level targeting criteria, such as location, audience, and platform, programmatically.\u003c/p\u003e\n"],["\u003cp\u003eUtilize methods like \u003ccode\u003eadSchedules()\u003c/code\u003e, \u003ccode\u003eaudiences()\u003c/code\u003e, and \u003ccode\u003etargetedLocations()\u003c/code\u003e to retrieve specific targeting criteria.\u003c/p\u003e\n"],["\u003cp\u003eControl targeting settings with \u003ccode\u003egetTargetingSetting()\u003c/code\u003e and \u003ccode\u003esetTargetingSetting()\u003c/code\u003e for criterion type groups like \u003ccode\u003eUSER_INTEREST_AND_LIST\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eBuild and add new user list audiences to campaigns using \u003ccode\u003enewUserListBuilder()\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eLeverage the provided code example to efficiently select and iterate through targeted locations within a campaign.\u003c/p\u003e\n"]]],[],null,[]]