/// <summary> /// Creates the shopping campaign. /// </summary> /// <param name="user">The AdWords user.</param> /// <param name="budgetId">The budget id.</param> /// <param name="merchantId">The Merchant Center id.</param> /// <returns>The Shopping campaign.</returns> private static Campaign CreateCampaign(AdWordsUser user, long budgetId, long merchantId) { CampaignService campaignService = (CampaignService)user.GetService( AdWordsService.v201710.CampaignService); // Create campaign. Campaign campaign = new Campaign(); campaign.name = "Shopping campaign #" + ExampleUtilities.GetRandomString(); // The advertisingChannelType is what makes this a Shopping campaign. campaign.advertisingChannelType = AdvertisingChannelType.SHOPPING; // Recommendation: Set the campaign to PAUSED when creating it to prevent // the ads from immediately serving. Set to ENABLED once you've added // targeting and the ads are ready to serve. campaign.status = CampaignStatus.PAUSED; // Set shared budget (required). campaign.budget = new Budget(); campaign.budget.budgetId = budgetId; // Set bidding strategy (required). BiddingStrategyConfiguration biddingStrategyConfiguration = new BiddingStrategyConfiguration(); biddingStrategyConfiguration.biddingStrategyType = BiddingStrategyType.MANUAL_CPC; campaign.biddingStrategyConfiguration = biddingStrategyConfiguration; // All Shopping campaigns need a ShoppingSetting. ShoppingSetting shoppingSetting = new ShoppingSetting(); shoppingSetting.salesCountry = "US"; shoppingSetting.campaignPriority = 0; shoppingSetting.merchantId = merchantId; // Set to "true" to enable Local Inventory Ads in your campaign. shoppingSetting.enableLocal = true; campaign.settings = new Setting[] { shoppingSetting }; // Create operation. CampaignOperation campaignOperation = new CampaignOperation(); campaignOperation.operand = campaign; campaignOperation.@operator = Operator.ADD; // Make the mutate request. CampaignReturnValue retval = campaignService.mutate( new CampaignOperation[] { campaignOperation }); campaignService.Close(); return(retval.value[0]); }