Skip to content

Commit 704cd34

Browse files
authored
Rename hotelads example package to travel and update placeholder values in examples
New values for email addresses, phone numbers, etc. adhere to the recommendations from https://developers.google.com/style/examples#example-domain-names.
1 parent 4b574fd commit 704cd34

11 files changed

Lines changed: 42 additions & 33 deletions

File tree

google-ads-examples/src/main/java/com/google/ads/googleads/examples/advancedoperations/AddCallAd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public static void main(String[] args) throws IOException {
121121
* @param customerId the client customer ID.
122122
* @param adGroupId the ad group ID to add a call ad to.
123123
* @param phoneCountry the phone country (2-letter code).
124-
* @param phoneNumber the raw phone number, e.g. '(123) 456-7890'.
124+
* @param phoneNumber the raw phone number, e.g. '(800) 555-0100'.
125125
* @param conversionActionId the conversion action ID to attribute conversions to.
126126
* @throws GoogleAdsException if an API request failed with one or more service errors.
127127
*/

google-ads-examples/src/main/java/com/google/ads/googleads/examples/advancedoperations/AddSmartCampaign.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public class AddSmartCampaign {
7575
private static final String COUNTRY_CODE = "US";
7676
private static final String LANGUAGE_CODE = "en";
7777
private static final String LANDING_PAGE_URL = "http://www.example.com";
78-
private static final String PHONE_NUMBER = "555-555-5555";
78+
private static final String PHONE_NUMBER = "800-555-0100";
7979
private static final long BUDGET_TEMPORARY_ID = -1;
8080
private static final long SMART_CAMPAIGN_TEMPORARY_ID = -2;
8181
private static final long AD_GROUP_TEMPORARY_ID = -3;

google-ads-examples/src/main/java/com/google/ads/googleads/examples/extensions/AddCall.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@
2626
import com.google.ads.googleads.v14.enums.MinuteOfHourEnum.MinuteOfHour;
2727
import com.google.ads.googleads.v14.errors.GoogleAdsError;
2828
import com.google.ads.googleads.v14.errors.GoogleAdsException;
29+
import com.google.ads.googleads.v14.resources.Asset;
2930
import com.google.ads.googleads.v14.resources.CustomerAsset;
31+
import com.google.ads.googleads.v14.services.AssetOperation;
3032
import com.google.ads.googleads.v14.services.AssetServiceClient;
3133
import com.google.ads.googleads.v14.services.CustomerAssetOperation;
3234
import com.google.ads.googleads.v14.services.CustomerAssetServiceClient;
3335
import com.google.ads.googleads.v14.services.MutateAssetsResponse;
3436
import com.google.ads.googleads.v14.services.MutateCustomerAssetsResponse;
3537
import com.google.ads.googleads.v14.utils.ResourceNames;
36-
import com.google.ads.googleads.v14.resources.Asset;
37-
import com.google.ads.googleads.v14.services.AssetOperation;
3838
import com.google.common.collect.ImmutableList;
3939
import java.io.FileNotFoundException;
4040
import java.io.IOException;
@@ -117,7 +117,7 @@ public static void main(String[] args) throws IOException {
117117
* @param googleAdsClient the Google Ads API client.
118118
* @param customerId the client customer ID.
119119
* @param phoneCountry the phone country (2-letter code).
120-
* @param phoneNumber the raw phone number, e.g. '(123) 456-7890'.
120+
* @param phoneNumber the raw phone number, e.g. '(800) 555-0100'.
121121
* @param conversionActionId the conversion action ID to attribute conversions to.
122122
* @throws GoogleAdsException if an API request failed with one or more service errors.
123123
*/
@@ -142,7 +142,7 @@ private void runExample(
142142
* @param googleAdsClient the Google Ads API client.
143143
* @param customerId the client customer ID.
144144
* @param phoneCountry the phone country (2-letter code).
145-
* @param phoneNumber the raw phone number, e.g. '(123) 456-7890'.
145+
* @param phoneNumber the raw phone number, e.g. '(800) 555-0100'.
146146
* @param conversionActionId the conversion action ID to attribute conversions to.
147147
* @return resource name of the newly created asset.
148148
*/

google-ads-examples/src/main/java/com/google/ads/googleads/examples/remarketing/AddCustomerMatchUserList.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -375,28 +375,28 @@ private List<OfflineUserDataJobOperation> buildOfflineUserDataJobOperations()
375375
// The first user data has an email address and a phone number.
376376
Map<String, String> rawRecord1 =
377377
ImmutableMap.<String, String>builder()
378-
.put("email", "test@gmail.com")
378+
.put("email", "dana@example.com")
379379
// Phone number to be converted to E.164 format, with a leading '+' as required. This
380380
// includes whitespace that will be removed later.
381-
.put("phone", "+1 234 5678910")
381+
.put("phone", "+1 800 5550101")
382382
.build();
383383
// The second user data has an email address, a mailing address, and a phone number.
384384
Map<String, String> rawRecord2 =
385385
ImmutableMap.<String, String>builder()
386-
// Email address that includes a period (.) before the Gmail domain.
387-
.put("email", "test.2@gmail.com")
386+
// Email address that includes a period (.) before the domain.
387+
.put("email", "alex.2@example.com")
388388
// Address that includes all four required elements: first name, last name, country
389389
// code, and postal code.
390-
.put("firstName", "John")
391-
.put("lastName", "Doe")
390+
.put("firstName", "Alex")
391+
.put("lastName", "Quinn")
392392
.put("countryCode", "US")
393-
.put("postalCode", "10011")
393+
.put("postalCode", "94045")
394394
// Phone number to be converted to E.164 format, with a leading '+' as required.
395-
.put("phone", "+1 234 5678911")
395+
.put("phone", "+1 800 5550102")
396396
.build();
397397
// The third user data only has an email address.
398398
Map<String, String> rawRecord3 =
399-
ImmutableMap.<String, String>builder().put("email", "test3@gmail.com").build();
399+
ImmutableMap.<String, String>builder().put("email", "charlie@example.com").build();
400400
// Adds the raw records to the raw input list.
401401
rawRecords.add(rawRecord1);
402402
rawRecords.add(rawRecord2);

google-ads-examples/src/main/java/com/google/ads/googleads/examples/remarketing/UploadCallConversion.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@ private static class UploadCallConversionParams extends CodeSampleParams {
4646
@Parameter(names = ArgumentNames.CONVERSION_ACTION_ID)
4747
private String conversionActionId;
4848

49-
@Parameter(names = ArgumentNames.CALLER_ID)
49+
@Parameter(
50+
names = ArgumentNames.CALLER_ID,
51+
description =
52+
"The caller ID from which this call was placed. Caller ID is expected to be in E.164"
53+
+ " format with preceding '+' sign, e.g. \"+18005550100\"")
5054
private String callerId;
5155

5256
@Parameter(

google-ads-examples/src/main/java/com/google/ads/googleads/examples/remarketing/UploadConversionEnhancement.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,8 @@ private void runExample(
166166
UserIdentifier.newBuilder()
167167
.setAddressInfo(
168168
OfflineUserAddressInfo.newBuilder()
169-
.setHashedFirstName(normalizeAndHash(sha256Digest, "Joanna"))
170-
.setHashedLastName(normalizeAndHash(sha256Digest, "Smith"))
169+
.setHashedFirstName(normalizeAndHash(sha256Digest, "Dana"))
170+
.setHashedLastName(normalizeAndHash(sha256Digest, "Quinn"))
171171
.setHashedStreetAddress(
172172
normalizeAndHash(sha256Digest, "1600 Amphitheatre Pkwy"))
173173
.setCity("Mountain View")
@@ -183,7 +183,7 @@ private void runExample(
183183
UserIdentifier.newBuilder()
184184
.setUserIdentifierSource(UserIdentifierSource.FIRST_PARTY)
185185
// Uses the normalize and hash method specifically for email addresses.
186-
.setHashedEmail(normalizeAndHashEmailAddress(sha256Digest, "joannasmith@example.com"))
186+
.setHashedEmail(normalizeAndHashEmailAddress(sha256Digest, "dana@example.com"))
187187
.build();
188188

189189
// Adds the user identifiers to the enhancement adjustment.

google-ads-examples/src/main/java/com/google/ads/googleads/examples/remarketing/UploadStoreSalesTransactions.java

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,9 @@ private static class UploadStoreSalesTransactionsParams extends CodeSampleParams
154154
private static final String CUSTOM_VALUE = null;
155155

156156
public static void main(String[] args)
157-
throws InterruptedException, ExecutionException, TimeoutException,
157+
throws InterruptedException,
158+
ExecutionException,
159+
TimeoutException,
158160
UnsupportedEncodingException {
159161
UploadStoreSalesTransactionsParams params = new UploadStoreSalesTransactionsParams();
160162
if (!params.parseArguments(args)) {
@@ -284,7 +286,9 @@ private void runExample(
284286
String countryCode,
285287
String languageCode,
286288
int quantity)
287-
throws InterruptedException, ExecutionException, TimeoutException,
289+
throws InterruptedException,
290+
ExecutionException,
291+
TimeoutException,
288292
UnsupportedEncodingException {
289293
String offlineUserDataJobResourceName;
290294
try (OfflineUserDataJobServiceClient offlineUserDataJobServiceClient =
@@ -444,7 +448,9 @@ private void addTransactionsToOfflineUserDataJob(
444448
String countryCode,
445449
String languageCode,
446450
Integer quantity)
447-
throws InterruptedException, ExecutionException, TimeoutException,
451+
throws InterruptedException,
452+
ExecutionException,
453+
TimeoutException,
448454
UnsupportedEncodingException {
449455
// Constructs the operation for each transaction.
450456
List<OfflineUserDataJobOperation> userDataJobOperations =
@@ -492,12 +498,11 @@ private void addTransactionsToOfflineUserDataJob(
492498
// Checks if any warnings occurred and displays details.
493499
if (response.hasWarning()) {
494500
// Converts the Any in response back to a GoogleAdsFailure object.
495-
GoogleAdsFailure warningsFailure = ErrorUtils.getInstance()
496-
.getGoogleAdsFailure(response.getWarning());
501+
GoogleAdsFailure warningsFailure =
502+
ErrorUtils.getInstance().getGoogleAdsFailure(response.getWarning());
497503
// Prints some information about the warnings encountered.
498504
System.out.println(
499-
System.out.printf(
500-
"Encountered %d warning(s).%n", warningsFailure.getErrorsCount()));
505+
System.out.printf("Encountered %d warning(s).%n", warningsFailure.getErrorsCount()));
501506
}
502507
// [END enable_warnings_2]
503508
} else {
@@ -540,7 +545,7 @@ private List<OfflineUserDataJobOperation> buildOfflineUserDataJobOperations(
540545
UserIdentifier.newBuilder()
541546
.setHashedEmail(
542547
// Email addresses must be normalized and hashed.
543-
normalizeAndHash(sha256Digest, "customer@example.com"))
548+
normalizeAndHash(sha256Digest, "dana@example.com"))
544549
.build(),
545550
UserIdentifier.newBuilder()
546551
.setAddressInfo(OfflineUserAddressInfo.newBuilder().setState("NY"))
@@ -571,8 +576,8 @@ private List<OfflineUserDataJobOperation> buildOfflineUserDataJobOperations(
571576
UserIdentifier.newBuilder()
572577
.setAddressInfo(
573578
OfflineUserAddressInfo.newBuilder()
574-
.setHashedFirstName(normalizeAndHash(sha256Digest, "John"))
575-
.setHashedLastName(normalizeAndHash(sha256Digest, "Doe"))
579+
.setHashedFirstName(normalizeAndHash(sha256Digest, "Dana"))
580+
.setHashedLastName(normalizeAndHash(sha256Digest, "Quinn"))
576581
.setCountryCode("US")
577582
.setPostalCode("10011")))
578583
.setTransactionAttribute(

google-ads-examples/src/main/java/com/google/ads/googleads/examples/hotelads/AddHotelAd.java renamed to google-ads-examples/src/main/java/com/google/ads/googleads/examples/travel/AddHotelAd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
package com.google.ads.googleads.examples.hotelads;
15+
package com.google.ads.googleads.examples.travel;
1616

1717
import static com.google.ads.googleads.examples.utils.CodeSampleHelper.getPrintableDateTime;
1818

google-ads-examples/src/main/java/com/google/ads/googleads/examples/hotelads/AddHotelAdGroupBidModifiers.java renamed to google-ads-examples/src/main/java/com/google/ads/googleads/examples/travel/AddHotelAdGroupBidModifiers.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
package com.google.ads.googleads.examples.hotelads;
15+
package com.google.ads.googleads.examples.travel;
1616

1717
import com.beust.jcommander.Parameter;
1818
import com.google.ads.googleads.examples.utils.ArgumentNames;

google-ads-examples/src/main/java/com/google/ads/googleads/examples/hotelads/AddHotelListingGroupTree.java renamed to google-ads-examples/src/main/java/com/google/ads/googleads/examples/travel/AddHotelListingGroupTree.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
package com.google.ads.googleads.examples.hotelads;
15+
package com.google.ads.googleads.examples.travel;
1616

1717
import com.beust.jcommander.Parameter;
1818
import com.google.ads.googleads.examples.utils.ArgumentNames;

0 commit comments

Comments
 (0)