Hi, thanks for reply. Actually I’m trying to relate the links you shared regarding AddCustomerMatch. I have few doubts :
- Is adding remarketing user list audience is same as adding customer march user list?
- how conversion tracker service is mapped to this ?because In old api sample there is usage of conversiontype and I’m looking similar.
- what is the new api equivalent to the below code specifically conversiontracker service, create conversion type, getting and displaying conversion ids and trackers.
Thanks
————
Get the ConversionTrackerService.
ConversionTrackerServiceInterface conversionTrackerService =
adWordsServices.get(session, ConversionTrackerServiceInterface.class);
// Create conversion type (tag). (## Get the ConversionTrackerService.
ConversionTrackerServiceInterface conversionTrackerService =
adWordsServices.get(session, ConversionTrackerServiceInterface.class);
// Create conversion type (tag).
UserListConversionType conversionType = new UserListConversionType();
conversionType.setName("Mars cruise customers #" + System.currentTimeMillis());
// Create remarketing user list.
BasicUserList userList = new BasicUserList();
userList.setName("Mars cruise customers #" + System.currentTimeMillis());
userList.setDescription("A list of mars cruise customers in the last year");
userList.setMembershipLifeSpan(365L);
userList.setConversionTypes(new UserListConversionType[] {conversionType});
// You can optionally provide these field(s).
userList.setStatus(UserListMembershipStatus.OPEN);
// Create operations.
UserListOperation operation = new UserListOperation();
operation.setOperand(userList);
operation.setOperator(Operator.ADD);
UserListOperation[] operations = new UserListOperation[] {operation};
// Add user list.
UserListReturnValue result = userListService.mutate(operations);
// Display results.
// Capture the ID(s) of the conversion.
List<String> conversionIds = new ArrayList<>();
for (UserList userListResult : result.getValue()) {
if (userListResult instanceof BasicUserList) {
BasicUserList remarketingUserList = (BasicUserList) userListResult;
for (UserListConversionType userListConversionType :
remarketingUserList.getConversionTypes()) {
conversionIds.add(userListConversionType.getId().toString());
}
}
}
// Create predicate and selector.
Selector selector = new SelectorBuilder()
.fields("Id", "GoogleGlobalSiteTag", "GoogleEventSnippet")
.in(AdwordsUserListField.Id, conversionIds.toArray(new String[0]))
.build();
// Get all conversion trackers.
Map<Long, AdWordsConversionTracker> conversionTrackers =
new HashMap<Long, AdWordsConversionTracker>();
ConversionTrackerPage page = conversionTrackerService.get(selector);
if (page != null && page.getEntries() != null) {
conversionTrackers =
Arrays.stream(page.getEntries())
.collect(
Collectors.toMap(
conversionTracker -> conversionTracker.getId(),
conversionTracker -> (AdWordsConversionTracker) conversionTracker));
} one)
UserListConversionType conversionType = new UserListConversionType();
conversionType.setName("Mars cruise customers #" + System.currentTimeMillis());
// Create remarketing user list.
BasicUserList userList = new BasicUserList();
userList.setName("Mars cruise customers #" + System.currentTimeMillis());
userList.setDescription("A list of mars cruise customers in the last year");
userList.setMembershipLifeSpan(365L);
userList.setConversionTypes(new UserListConversionType[] {conversionType});
// You can optionally provide these field(s).
userList.setStatus(UserListMembershipStatus.OPEN);
// Create operations.
UserListOperation operation = new UserListOperation();
operation.setOperand(userList);
operation.setOperator(Operator.ADD);
UserListOperation[] operations = new UserListOperation[] {operation};
// Add user list.
UserListReturnValue result = userListService.mutate(operations);
// Display results.
// Capture the ID(s) of the conversion.
List<String> conversionIds = new ArrayList<>();
for (UserList userListResult : result.getValue()) {
if (userListResult instanceof BasicUserList) {
BasicUserList remarketingUserList = (BasicUserList) userListResult;
for (UserListConversionType userListConversionType :
remarketingUserList.getConversionTypes()) {
conversionIds.add(userListConversionType.getId().toString());
}
}
}
// Create predicate and selector.
Selector selector = new SelectorBuilder()
.fields("Id", "GoogleGlobalSiteTag", "GoogleEventSnippet")
.in(AdwordsUserListField.Id, conversionIds.toArray(new String[0]))
.build();
// Get all conversion trackers.
Map<Long, AdWordsConversionTracker> conversionTrackers =
new HashMap<Long, AdWordsConversionTracker>();
ConversionTrackerPage page = conversionTrackerService.get(selector);
if (page != null && page.getEntries() != null) {
conversionTrackers =
Arrays.stream(page.getEntries())
.collect(
Collectors.toMap(
conversionTracker -> conversionTracker.getId(),
conversionTracker -> (AdWordsConversionTracker) conversionTracker));
}