Search in sources :

Example 1 with CriterionUserList

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 });
}
Also used : AdGroupCriterionOperation(com.google.api.ads.adwords.axis.v201809.cm.AdGroupCriterionOperation) AdGroupCriterionServiceInterface(com.google.api.ads.adwords.axis.v201809.cm.AdGroupCriterionServiceInterface) BiddableAdGroupCriterion(com.google.api.ads.adwords.axis.v201809.cm.BiddableAdGroupCriterion) CriterionUserList(com.google.api.ads.adwords.axis.v201809.cm.CriterionUserList)

Aggregations

AdGroupCriterionOperation (com.google.api.ads.adwords.axis.v201809.cm.AdGroupCriterionOperation)1 AdGroupCriterionServiceInterface (com.google.api.ads.adwords.axis.v201809.cm.AdGroupCriterionServiceInterface)1 BiddableAdGroupCriterion (com.google.api.ads.adwords.axis.v201809.cm.BiddableAdGroupCriterion)1 CriterionUserList (com.google.api.ads.adwords.axis.v201809.cm.CriterionUserList)1