Search in sources :

Example 21 with CampaignOperation

use of com.google.api.ads.adwords.axis.v201809.cm.CampaignOperation in project googleads-java-lib by googleads.

the class AddCompleteCampaignsUsingBatchJob method buildAdGroupOperations.

private static List<AdGroupOperation> buildAdGroupOperations(Iterator<Long> tempIdGenerator, String namePrefix, Iterable<CampaignOperation> campaignOperations) {
    List<AdGroupOperation> operations = new ArrayList<>();
    for (CampaignOperation campaignOperation : campaignOperations) {
        for (int i = 0; i < NUMBER_OF_ADGROUPS_TO_ADD; i++) {
            AdGroup adGroup = new AdGroup();
            adGroup.setCampaignId(campaignOperation.getOperand().getId());
            adGroup.setId(tempIdGenerator.next());
            adGroup.setName(String.format("Batch Ad Group %s.%s", namePrefix, i));
            BiddingStrategyConfiguration biddingStrategyConfiguration = new BiddingStrategyConfiguration();
            CpcBid bid = new CpcBid();
            bid.setBid(new Money(null, 10000000L));
            biddingStrategyConfiguration.setBids(new Bids[] { bid });
            adGroup.setBiddingStrategyConfiguration(biddingStrategyConfiguration);
            AdGroupOperation operation = new AdGroupOperation();
            operation.setOperand(adGroup);
            operation.setOperator(Operator.ADD);
            operations.add(operation);
        }
    }
    return operations;
}
Also used : Money(com.google.api.ads.adwords.axis.v201809.cm.Money) BiddingStrategyConfiguration(com.google.api.ads.adwords.axis.v201809.cm.BiddingStrategyConfiguration) CampaignOperation(com.google.api.ads.adwords.axis.v201809.cm.CampaignOperation) ArrayList(java.util.ArrayList) AdGroup(com.google.api.ads.adwords.axis.v201809.cm.AdGroup) CpcBid(com.google.api.ads.adwords.axis.v201809.cm.CpcBid) AdGroupOperation(com.google.api.ads.adwords.axis.v201809.cm.AdGroupOperation)

Aggregations

CampaignOperation (com.google.api.ads.adwords.axis.v201809.cm.CampaignOperation)18 Campaign (com.google.api.ads.adwords.axis.v201809.cm.Campaign)15 CampaignServiceInterface (com.google.api.ads.adwords.axis.v201809.cm.CampaignServiceInterface)11 BiddingStrategyConfiguration (com.google.api.ads.adwords.axis.v201809.cm.BiddingStrategyConfiguration)10 Budget (com.google.api.ads.adwords.axis.v201809.cm.Budget)9 CampaignReturnValue (com.google.api.ads.adwords.axis.v201809.cm.CampaignReturnValue)9 ArrayList (java.util.ArrayList)5 AdGroupOperation (com.google.api.ads.adwords.axis.v201809.cm.AdGroupOperation)4 AdGroup (com.google.api.ads.adwords.axis.v201809.cm.AdGroup)3 ManualCpcBiddingScheme (com.google.api.ads.adwords.axis.v201809.cm.ManualCpcBiddingScheme)3 Money (com.google.api.ads.adwords.axis.v201809.cm.Money)3 ShoppingSetting (com.google.api.ads.adwords.axis.v201809.cm.ShoppingSetting)3 Campaign (com.google.api.ads.adwords.jaxws.v201809.cm.Campaign)3 CampaignOperation (com.google.api.ads.adwords.jaxws.v201809.cm.CampaignOperation)3 SelectorBuilder (com.google.api.ads.adwords.axis.utils.v201809.SelectorBuilder)2 AdGroupAdOperation (com.google.api.ads.adwords.axis.v201809.cm.AdGroupAdOperation)2 AdGroupCriterionOperation (com.google.api.ads.adwords.axis.v201809.cm.AdGroupCriterionOperation)2 BudgetOperation (com.google.api.ads.adwords.axis.v201809.cm.BudgetOperation)2 CampaignCriterionOperation (com.google.api.ads.adwords.axis.v201809.cm.CampaignCriterionOperation)2 DynamicSearchAdsSetting (com.google.api.ads.adwords.axis.v201809.cm.DynamicSearchAdsSetting)2