RE: facing issues while creating the customer match list

2024-05-15 Thread 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum
Hi,

Thank you for reaching out to the Google Ads API support team.

Note that the provided logs are incomplete and don't include the details on how 
you are uploading the user data. So, in order to assist you further, kindly 
provide us with the "complete API logs" (request and response with request-id 
and request header) generated at your end while working with Customer Match.

If you are using a client library and haven't enabled the logging yet, I would 
request you to enable logging for the specific client library that you are 
using. You can refer to the guides Java, .Net, PHP, Python, Ruby or Perl to 
enable logging at your end. For REST interface requests, you can enable logging 
via the curl command by using the -i flag.

Also, I would recommend you to follow this guide on Get Started with Customer 
Match for more information about creating and targeting a customer list.

This message is in relation to case "ref:!00D1U01174p.!5004Q02tIyAz:ref" 
(ADR-00234928)

Thanks,

Google Ads API Team

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Google Ads API and AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/qVi000SDJ0TT0027oau5m3SH-fs1MGWaHxRw%40sfdc.net.


Facing Issues While Creating the Customer Match List

2024-05-14 Thread Abhishek Singh
Problem - While Creating the Customer Match List i am finding that Customer 
List Is getting created but uploads is showing 0 and its not about time 
because i've waited 2 - 3 days.*(Attaching Image)*

*[image: Screenshot from 2024-05-13 04-26-48.png]*

*CSV*
Email,Phone,First Name,Last Name,Country,Zip\n
x...@gmail.com,81-12-3456-7891,john,smith,us,94016\n
a...@gmail.com,81-12-3456-7891,joanna,smith,cn,101300\n

*RESPONSE, REQUEST*
Number of records read from CSV: 2
Processing record: x...@gmail.com
Processing record: a...@gmail.com
2024-05-13 04:23:05.570  INFO 8206 --- [ault-executor-0] 
c.g.ads.googleads.lib.request.summary: SUCCESS REQUEST SUMMARY. Method: 
google.ads.googleads.v16.services.UserListService/MutateUserLists, 
Endpoint: googleads.googleapis.com:443, CustomerID: 5084430664, RequestID: 
Jbr3MMpM8Zu_K5NKBQnOow, ResponseCode: OK, Fault: null.
Created Customer Match user list with resource name: 
customers/5084430664/userLists/8658557609.

2024-05-13 04:23:22.230  INFO 8206 --- [ault-executor-2] 
c.g.ads.googleads.lib.request.summary: SUCCESS REQUEST SUMMARY. Method: 
google.ads.googleads.v16.services.GoogleAdsService/Search, Endpoint: 
googleads.googleapis.com:443, CustomerID: 5084430664, RequestID: 
QUQub7mmT6J2HEMrIQ5BwQ, ResponseCode: OK, Fault: null.
User list 'customers/5084430664/userLists/8658557609' has an estimated 0 
users for Display and 0 users for Search.


*CODE(JAVA)*

public void addCustomerDataFromCSV(GoogleAdsClient googleAdsClient, long 
customerId, 
String filePath) {
try {
List customerRecords = CsvParser.parseCsv(filePath);

System.out.println("Number of records read from CSV: " + 
customerRecords.size());

// Accumulate user data for all records
List userDataList = new ArrayList<>();

for (CustomerRecord record : customerRecords) {
System.out.println("Processing record: " + record.getEmail());
// Create user data for each record
UserData userData = createUserDataForRecord(record);
userDataList.add(userData);
}

// Create a single user list containing data from all records
createCustomerMatchUserList(googleAdsClient, customerId, userDataList);
} catch (IOException e) {
e.printStackTrace();
}
}

private UserData createUserDataForRecord(CustomerRecord record) {
// Inside your class or method
MessageDigest sha256Digest;
UserData.Builder userDataBuilder = UserData.newBuilder();

try {
sha256Digest = MessageDigest.getInstance("SHA-256");

// Add email as a UserIdentifier
UserIdentifier hashedEmailIdentifier = UserIdentifier.newBuilder()
.setHashedEmail(normalizeAndHashEmailAddress(sha256Digest, 
record.getEmail()))
.build();
userDataBuilder.addUserIdentifiers(hashedEmailIdentifier);

// Add phone number as a UserIdentifier
if (record.getPhone() != null && !record.getPhone().isEmpty()) {
UserIdentifier hashedPhoneNumberIdentifier = UserIdentifier.newBuilder()
.setHashedPhoneNumber(normalizeAndHash(sha256Digest, record.getPhone(), true
))
.build();
userDataBuilder.addUserIdentifiers(hashedPhoneNumberIdentifier);
}

// Add other fields such as First Name, Last Name, Country, and Zip
OfflineUserAddressInfo addressInfo = OfflineUserAddressInfo.newBuilder()
.setHashedFirstName(normalizeAndHash(sha256Digest, record.getFirstName(), 
true))
.setHashedLastName(normalizeAndHash(sha256Digest, record.getLastName(), true
))
.setCountryCode(record.getCountryCode())
.setPostalCode(record.getPostalCode())
.build();
UserIdentifier addressIdentifier = UserIdentifier.newBuilder()
.setAddressInfo(addressInfo)
.build();
userDataBuilder.addUserIdentifiers(addressIdentifier);


} catch (NoSuchAlgorithmException | UnsupportedEncodingException e) {
// Handle the exception
e.printStackTrace();
}

return userDataBuilder.build();
}


private void createCustomerMatchUserList(GoogleAdsClient googleAdsClient, long 
customerId, List userDataList) {
try (UserListServiceClient userListServiceClient =
googleAdsClient.getLatestVersion().createUserListServiceClient()) {
// Create the user list
UserList userList = UserList.newBuilder()
.setName("Customer Match list") // Provide a name for the list
.setDescription("A list of customers that originated from email addresses")
.setMembershipLifeSpan(30) // Set the membership lifespan as required
.setCrmBasedUserList(
CrmBasedUserListInfo.newBuilder()
.setUploadKeyType(CustomerMatchUploadKeyTypeEnum.CustomerMatchUploadKeyType.
CONTACT_INFO))

.build();

// Create the operation to add users
List operations = new ArrayList<>();
for (UserData userData : userDataList) {
operations.add(OfflineUserDataJobOperation.newBuilder
().setCreate(userData).build());
}

// Add the user list with all users
MutateUserListsResponse response = userListServiceClient.mutateUserLists(
Long.toString(customerId), ImmutableList.of(UserListOperation.newBuilder
().setCreate(userList).build()));

System.out.printf("Created Customer Match user list with resource name: 
%s.%n",
response.getResults(0).getResourceName());

// Fetch the user list details
String userListResourceName =