Skip to content

Commit 253e785

Browse files
authored
Change --countryCode param to --salesCountry in PMax retail example (#597)
- Makes Java consistent with other libraries - Aligns the parameter name with the ShoppingSetting field name
1 parent 85d5120 commit 253e785

2 files changed

Lines changed: 11 additions & 10 deletions

File tree

google-ads-examples/src/main/java/com/google/ads/googleads/examples/shoppingads/AddPerformanceMaxRetailCampaign.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ private static class AddPerformanceMaxRetailCampaignParams extends CodeSamplePar
122122
private long merchantCenterAccountId;
123123

124124
@Parameter(
125-
names = ArgumentNames.COUNTRY_CODE,
125+
names = ArgumentNames.SALES_COUNTRY,
126126
description = "The sales country of products to include in the campaign.")
127-
private String countryCode = "US";
127+
private String salesCountry = "US";
128128

129129
@Parameter(
130130
names = ArgumentNames.FINAL_URL,
@@ -145,8 +145,8 @@ public static void main(String[] args) throws IOException {
145145
params.merchantCenterAccountId = Long.parseLong("INSERT_MERCHANT_CENTER_ACCOUNT_ID_HERE");
146146
params.finalUrl = "INSERT_FINAL_URL_HERE";
147147

148-
// Optionally set the country code.
149-
// params.countryCode = "INSERT_COUNTRY_CODE_HERE";
148+
// Optionally set the sales country.
149+
// params.salesCountry = "INSERT_SALES_COUNTRY_HERE";
150150
}
151151

152152
GoogleAdsClient googleAdsClient = null;
@@ -167,7 +167,7 @@ public static void main(String[] args) throws IOException {
167167
googleAdsClient,
168168
params.customerId,
169169
params.merchantCenterAccountId,
170-
params.countryCode,
170+
params.salesCountry,
171171
params.finalUrl);
172172
} catch (GoogleAdsException gae) {
173173
// GoogleAdsException is the base class for most exceptions thrown by an API request.
@@ -192,14 +192,14 @@ public static void main(String[] args) throws IOException {
192192
* @param googleAdsClient the Google Ads API client.
193193
* @param customerId the client customer ID.
194194
* @param merchantCenterAccountId the Merchant Center account ID.
195-
* @param countryCode sales country of products to include in the campaign.
195+
* @param salesCountry sales country of products to include in the campaign.
196196
* @param finalUrl final URL for the asset group of the campaign.
197197
*/
198198
private void runExample(
199199
GoogleAdsClient googleAdsClient,
200200
long customerId,
201201
long merchantCenterAccountId,
202-
String countryCode,
202+
String salesCountry,
203203
String finalUrl)
204204
throws IOException {
205205
// [START add_performance_max_retail_campaign_1]
@@ -233,7 +233,7 @@ private void runExample(
233233
List<MutateOperation> mutateOperations = new ArrayList<>();
234234
mutateOperations.add(createCampaignBudgetOperation(customerId));
235235
mutateOperations.add(
236-
createPerformanceMaxCampaignOperation(customerId, merchantCenterAccountId, countryCode));
236+
createPerformanceMaxCampaignOperation(customerId, merchantCenterAccountId, salesCountry));
237237
mutateOperations.addAll(createCampaignCriterionOperations(customerId));
238238
String assetGroupResourceName = ResourceNames.assetGroup(customerId, ASSET_GROUP_TEMPORARY_ID);
239239
mutateOperations.addAll(
@@ -283,7 +283,7 @@ private MutateOperation createCampaignBudgetOperation(long customerId) {
283283
// [START add_performance_max_retail_campaign_3]
284284
/** Creates a MutateOperation that creates a new Performance Max campaign. */
285285
private MutateOperation createPerformanceMaxCampaignOperation(
286-
long customerId, long merchantCenterAccountId, String countryCode) {
286+
long customerId, long merchantCenterAccountId, String salesCountry) {
287287
Campaign performanceMaxCampaign =
288288
Campaign.newBuilder()
289289
.setName("Performance Max retail campaign #" + getPrintableDateTime())
@@ -309,7 +309,7 @@ private MutateOperation createPerformanceMaxCampaignOperation(
309309
.setShoppingSetting(
310310
ShoppingSetting.newBuilder()
311311
.setMerchantId(merchantCenterAccountId)
312-
.setSalesCountry(countryCode)
312+
.setSalesCountry(salesCountry)
313313
.build())
314314
// Sets the Final URL expansion opt out. This flag is specific to
315315
// Performance Max campaigns. If opted out (true), only the final URLs in

google-ads-examples/src/main/java/com/google/ads/googleads/examples/utils/ArgumentNames.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ public final class ArgumentNames {
109109
public static final String RECOMMENDATION_ID = "--recommendationId";
110110
public static final String REPLACE_EXISTING_TREE = "--replaceExistingTree";
111111
public static final String RESTATEMENT_VALUE = "--restatementValue";
112+
public static final String SALES_COUNTRY = "--salesCountry";
112113
public static final String SITELINK_TEXT = "--sitelinkText";
113114
public static final String SQUARE_MARKETING_IMAGE_ID = "--squareMarketingImageAssetId";
114115
public static final String START_DATE_TIME = "--startDateTime";

0 commit comments

Comments
 (0)