use of com.google.api.ads.adwords.axis.v201809.cm.CriterionUserList in project googleads-java-lib by googleads.
the class AddShoppingDynamicRemarketingCampaign method attachUserList.
/**
* Attach a user list to an ad group. The user list provides positive targeting and feed
* information to drive the dynamic content of the ad.
*
* <p>Note: User lists must be attached at the ad group level for positive targeting in Shopping
* dynamic remarketing campaigns.
*
* @param adGroup the ad group which will have the user list attached.
* @param userListId the user list to use for targeting and dynamic content.
*/
private static void attachUserList(AdWordsServicesInterface services, AdWordsSession session, AdGroup adGroup, long userListId) throws RemoteException {
AdGroupCriterionServiceInterface adGroupCriterionService = services.get(session, AdGroupCriterionServiceInterface.class);
CriterionUserList userList = new CriterionUserList();
userList.setUserListId(userListId);
BiddableAdGroupCriterion adGroupCriterion = new BiddableAdGroupCriterion();
adGroupCriterion.setCriterion(userList);
adGroupCriterion.setAdGroupId(adGroup.getId());
AdGroupCriterionOperation op = new AdGroupCriterionOperation();
op.setOperand(adGroupCriterion);
op.setOperator(Operator.ADD);
adGroupCriterionService.mutate(new AdGroupCriterionOperation[] { op });
}
Aggregations