use of com.google.api.ads.adwords.jaxws.v201809.cm.Budget in project googleads-java-lib by googleads.
the class AddShoppingDynamicRemarketingCampaign method createCampaign.
/**
* Creates a Shopping dynamic remarketing campaign object (not including ad group level and
* below). This creates a Display campaign with the merchant center feed attached. Merchant Center
* is used for the product information in combination with a user list which contains hits with
* {@code ecomm_prodid} specified. See <a
* href="https://developers.google.com/adwords-remarketing-tag/parameters#retail"/>for more
* detail.
*
* @param merchantId the ID of the Merchant Center account.
* @param budgetId the ID of the budget to use for the campaign.
* @return the campaign that was created.
*/
private static Campaign createCampaign(AdWordsServicesInterface services, AdWordsSession session, long merchantId, long budgetId) throws RemoteException {
CampaignServiceInterface campaignService = services.get(session, CampaignServiceInterface.class);
Campaign campaign = new Campaign();
campaign.setName("Shopping campaign #" + System.currentTimeMillis());
// Dynamic remarketing campaigns are only available on the Google Display Network.
campaign.setAdvertisingChannelType(AdvertisingChannelType.DISPLAY);
campaign.setStatus(CampaignStatus.PAUSED);
Budget budget = new Budget();
budget.setBudgetId(budgetId);
campaign.setBudget(budget);
// This example uses a Manual CPC bidding strategy, but you should select the strategy that best
// aligns with your sales goals. More details here:
// https://support.google.com/adwords/answer/2472725
BiddingStrategyConfiguration biddingStrategyConfiguration = new BiddingStrategyConfiguration();
biddingStrategyConfiguration.setBiddingStrategyType(BiddingStrategyType.MANUAL_CPC);
campaign.setBiddingStrategyConfiguration(biddingStrategyConfiguration);
ShoppingSetting setting = new ShoppingSetting();
// Campaigns with numerically higher priorities take precedence over those with lower
// priorities.
setting.setCampaignPriority(0);
// Set the Merchant Center account ID from which to source products.
setting.setMerchantId(merchantId);
// Display Network campaigns do not support partition by country. The only supported value is
// "ZZ". This signals that products from all countries are available in the campaign. The actual
// products which serve are based on the products tagged in the user list entry.
setting.setSalesCountry("ZZ");
// Optional: Enable local inventory ads (items for sale in physical stores.)
setting.setEnableLocal(true);
campaign.setSettings(new Setting[] { setting });
CampaignOperation op = new CampaignOperation();
op.setOperand(campaign);
op.setOperator(Operator.ADD);
CampaignReturnValue result = campaignService.mutate(new CampaignOperation[] { op });
return result.getValue(0);
}
Aggregations