Package com.google.api.ads.adwords.axis.v201309.cm

Examples of com.google.api.ads.adwords.axis.v201309.cm.CampaignServiceInterface


    line1Attribute.setName("Line 1 Description");
    line2Attribute.setType(FeedAttributeType.STRING);
    line2Attribute.setName("Line 2 Description");
    feed.setAttributes(new FeedAttribute[] {line1Attribute, line2Attribute});

    FeedOperation feedOperation = new FeedOperation();
    feedOperation.setOperand(feed);
    feedOperation.setOperator(Operator.SET);

    FeedServiceInterface feedService = adWordsServices.get(session, FeedServiceInterface.class);
    FeedReturnValue mutateFeedResult = feedService.mutate(new FeedOperation[] {feedOperation});

    // Get the new attributes from the mutated feed.
View Full Code Here


    FeedOperation feedOperation = new FeedOperation();
    feedOperation.setOperand(feed);
    feedOperation.setOperator(Operator.SET);

    FeedServiceInterface feedService = adWordsServices.get(session, FeedServiceInterface.class);
    FeedReturnValue mutateFeedResult = feedService.mutate(new FeedOperation[] {feedOperation});

    // Get the new attributes from the mutated feed.
    Feed mutatedFeed = mutateFeedResult.getValue()[0];
    line1Attribute = mutatedFeed.getAttributes(nextAttributeIndex);
    line2Attribute = mutatedFeed.getAttributes(nextAttributeIndex + 1);
    return new FeedAttribute[] {line1Attribute, line2Attribute};
  }
View Full Code Here

    runExample(adWordsServices, session, feedId, feedItemDescriptions);
  }

  public static void runExample(AdWordsServices adWordsServices, AdWordsSession session,
      Long feedId, Map<Long, String[]> feedItemDescriptions) throws Exception {
    FeedServiceInterface feedService = adWordsServices.get(session, FeedServiceInterface.class);
    Selector selector = new Selector();
    // Do not include "Attributes" because you do not want to pass existing
    // attributes into the subsequent mutate (SET) call.
    selector.setFields(new String[] {"Id", "Attributes"});
    selector.setPredicates(new Predicate[] {
        new Predicate("Id", PredicateOperator.EQUALS, new String[] {feedId.toString()})});
    Feed feed = feedService.get(selector).getEntries()[0];

    // Add new attributes to the feed.
    FeedAttribute[] newAttributes = addLine1And2FeedAttributes(adWordsServices, session, feed);
    FeedAttribute line1Attribute = newAttributes[0];
    FeedAttribute line2Attribute = newAttributes[1];
View Full Code Here

    FeedOperation feedOperation = new FeedOperation();
    feedOperation.setOperand(feed);
    feedOperation.setOperator(Operator.SET);

    FeedServiceInterface feedService = adWordsServices.get(session, FeedServiceInterface.class);
    FeedReturnValue mutateFeedResult = feedService.mutate(new FeedOperation[] {feedOperation});

    // Get the new attributes from the mutated feed.
    Feed mutatedFeed = mutateFeedResult.getValue()[0];
    line1Attribute = mutatedFeed.getAttributes(nextAttributeIndex);
    line2Attribute = mutatedFeed.getAttributes(nextAttributeIndex + 1);
View Full Code Here

    // Add the budget
    Long budgetId =
        budgetService.mutate(new BudgetOperation[] {budgetOperation}).getValue(0).getBudgetId();

    // Get the CampaignService.
    CampaignServiceInterface campaignService =
        adWordsServices.get(session, CampaignServiceInterface.class);

    // Create campaign.
    Campaign campaign = new Campaign();
    campaign.setName("Interplanetary Cruise #" + System.currentTimeMillis());
    campaign.setStatus(CampaignStatus.PAUSED);
    BiddingStrategyConfiguration biddingStrategyConfiguration = new BiddingStrategyConfiguration();
    biddingStrategyConfiguration.setBiddingStrategyType(BiddingStrategyType.MANUAL_CPC);

    // You can optionally provide a bidding scheme in place of the type.
    ManualCpcBiddingScheme cpcBiddingScheme = new ManualCpcBiddingScheme();
    cpcBiddingScheme.setEnhancedCpcEnabled(false);
    biddingStrategyConfiguration.setBiddingScheme(cpcBiddingScheme);

    campaign.setBiddingStrategyConfiguration(biddingStrategyConfiguration);

    // You can optionally provide these field(s).
    campaign.setStartDate(new DateTime().plusDays(1).toString("yyyyMMdd"));
    campaign.setStartDate(new DateTime().plusDays(30).toString("yyyyMMdd"));
    campaign.setAdServingOptimizationStatus(AdServingOptimizationStatus.ROTATE);
    campaign.setFrequencyCap(new FrequencyCap(5L, TimeUnit.DAY, Level.ADGROUP));

    // Only the budgetId should be sent, all other fields will be ignored by CampaignService.
    Budget budget = new Budget();
    budget.setBudgetId(budgetId);
    campaign.setBudget(budget);

    campaign.setAdvertisingChannelType(AdvertisingChannelType.SEARCH);
   
    // Set the campaign network options to Search and Search Network.
    NetworkSetting networkSetting = new NetworkSetting();
    networkSetting.setTargetGoogleSearch(true);
    networkSetting.setTargetSearchNetwork(true);
    networkSetting.setTargetContentNetwork(false);
    networkSetting.setTargetPartnerSearchNetwork(false);
    campaign.setNetworkSetting(networkSetting);

    // Set options that are not required.
    GeoTargetTypeSetting geoTarget = new GeoTargetTypeSetting();
    geoTarget.setPositiveGeoTargetType(GeoTargetTypeSettingPositiveGeoTargetType.DONT_CARE);
    KeywordMatchSetting keywordMatch = new KeywordMatchSetting();
    keywordMatch.setOptIn(Boolean.FALSE);
    campaign.setSettings(new Setting[] {geoTarget, keywordMatch});

    // You can create multiple campaigns in a single request.
    Campaign campaign2 = new Campaign();
    campaign2.setName("Interplanetary Cruise banner #" + System.currentTimeMillis());
    campaign2.setStatus(CampaignStatus.PAUSED);
    BiddingStrategyConfiguration biddingStrategyConfiguration2 = new BiddingStrategyConfiguration();
    biddingStrategyConfiguration2.setBiddingStrategyType(BiddingStrategyType.MANUAL_CPC);
    campaign2.setBiddingStrategyConfiguration(biddingStrategyConfiguration2);

    Budget budget2 = new Budget();
    budget2.setBudgetId(budgetId);
    campaign2.setBudget(budget2);

    campaign2.setAdvertisingChannelType(AdvertisingChannelType.DISPLAY);

    KeywordMatchSetting keywordMatch2 = new KeywordMatchSetting();
    keywordMatch2.setOptIn(Boolean.FALSE);
    campaign2.setSettings(new Setting[] {keywordMatch2});

    // Create operations.
    CampaignOperation operation = new CampaignOperation();
    operation.setOperand(campaign);
    operation.setOperator(Operator.ADD);
    CampaignOperation operation2 = new CampaignOperation();
    operation2.setOperand(campaign2);
    operation2.setOperator(Operator.ADD);

    CampaignOperation[] operations = new CampaignOperation[] {operation, operation2};

    // Add campaigns.
    CampaignReturnValue result = campaignService.mutate(operations);

    // Display campaigns.
    for (Campaign campaignResult : result.getValue()) {
      System.out.println("Campaign with name \"" + campaignResult.getName() + "\" and id \""
          + campaignResult.getId() + "\" was added.");
View Full Code Here

  }

  public static void runExample(AdWordsServices adWordsServices, AdWordsSession session,
      Long budgetId, Long merchantId) throws Exception {
    // Get the CampaignService
    CampaignServiceInterface campaignService =
        adWordsServices.get(session, CampaignServiceInterface.class);

    // Create campaign.
    Campaign campaign = new Campaign();
    campaign.setName("Shopping campaign #" + System.currentTimeMillis());
    // The advertisingChannelType is what makes this a Shopping campaign
    campaign.setAdvertisingChannelType(AdvertisingChannelType.SHOPPING);

    // Set shared budget (required).
    Budget budget = new Budget();
    budget.setBudgetId(budgetId);
    campaign.setBudget(budget);

    // Set bidding strategy (required).
    BiddingStrategyConfiguration biddingStrategyConfiguration = new BiddingStrategyConfiguration();
    biddingStrategyConfiguration.setBiddingStrategyType(BiddingStrategyType.MANUAL_CPC);
    campaign.setBiddingStrategyConfiguration(biddingStrategyConfiguration);

    // Set keyword matching setting (required).
    KeywordMatchSetting keywordMatchSetting = new KeywordMatchSetting();
    keywordMatchSetting.setOptIn(false);

    // All Shopping campaigns need a ShoppingSetting.
    ShoppingSetting shoppingSetting = new ShoppingSetting();
    shoppingSetting.setSalesCountry("US");
    shoppingSetting.setCampaignPriority(0);
    shoppingSetting.setMerchantId(merchantId);
   
    campaign.setSettings(new Setting[] {keywordMatchSetting, shoppingSetting});

    // Create operation.
    CampaignOperation campaignOperation = new CampaignOperation();
    campaignOperation.setOperand(campaign);
    campaignOperation.setOperator(Operator.ADD);

    // Make the mutate request.
    CampaignReturnValue campaignAddResult =
        campaignService.mutate(new CampaignOperation[] {campaignOperation});

    // Display result.
    campaign = campaignAddResult.getValue(0);

    System.out.printf("Campaign with name '%s' and ID %d was added.%n", campaign.getName(),
View Full Code Here

  }

  public static void runExample(AdWordsServices adWordsServices, AdWordsSession session)
      throws Exception {
    // Get the CampaignService.
    CampaignServiceInterface campaignService =
        adWordsServices.get(session, CampaignServiceInterface.class);

    // Get the CustomerSyncService.
    CustomerSyncServiceInterface customerSyncService =
        adWordsServices.get(session, CustomerSyncServiceInterface.class);

    // Get a list of all campaign IDs.
    List<Long> campaignIds = new ArrayList<Long>();
    Selector selector = new SelectorBuilder()
        .fields("Id")
        .build();
    CampaignPage campaigns = campaignService.get(selector);
    if (campaigns.getEntries() != null) {
      for (Campaign campaign : campaigns.getEntries()) {
        campaignIds.add(campaign.getId());
      }
    }
View Full Code Here

  }

  public static void runExample(
      AdWordsServices adWordsServices, AdWordsSession session) throws Exception {
    // Get the CampaignService.
    CampaignServiceInterface campaignService =
        adWordsServices.get(session, CampaignServiceInterface.class);

    int offset = 0;

    // Create selector.
    SelectorBuilder builder = new SelectorBuilder();
    Selector selector = builder
        .fields("Id", "Name")
        .orderAscBy("Name")
        .offset(offset)
        .limit(PAGE_SIZE)
        .build();

    CampaignPage page = null;
    do {
      // Get all campaigns.
      page = campaignService.get(selector);

      // Display campaigns.
      if (page.getEntries() != null) {
        for (Campaign campaign : page.getEntries()) {
          System.out.println("Campaign with name \"" + campaign.getName() + "\" and id \""
View Full Code Here

  }

  public static void runExample(
      AdWordsServices adWordsServices, AdWordsSession session, Long campaignId) throws Exception {
    // Get the CampaignService.
    CampaignServiceInterface campaignService =
        adWordsServices.get(session, CampaignServiceInterface.class);

    // Create campaign with updated status.
    Campaign campaign = new Campaign();
    campaign.setId(campaignId);
    campaign.setStatus(CampaignStatus.PAUSED);

    // Create operations.
    CampaignOperation operation = new CampaignOperation();
    operation.setOperand(campaign);
    operation.setOperator(Operator.SET);

    CampaignOperation[] operations = new CampaignOperation[] {operation};

    // Update campaign.
    CampaignReturnValue result = campaignService.mutate(operations);

    // Display campaigns.
    for (Campaign campaignResult : result.getValue()) {
      System.out.println("Campaign with name \"" + campaignResult.getName() + "\", id \""
          + campaignResult.getId() + "\", and budget delivery method \""
View Full Code Here

  }

  public static void runExample(
      AdWordsServices adWordsServices, AdWordsSession session, long campaignId) throws Exception {
    // Get the CampaignService.
    CampaignServiceInterface campaignService =
        adWordsServices.get(session, CampaignServiceInterface.class);

    // Create campaign with DELETED status.
    Campaign campaign = new Campaign();
    campaign.setId(campaignId);
    campaign.setStatus(CampaignStatus.DELETED);

    // Create operations.
    CampaignOperation operation = new CampaignOperation();
    operation.setOperand(campaign);
    operation.setOperator(Operator.SET);

    CampaignOperation[] operations = new CampaignOperation[] {operation};

    // Delete campaign.
    CampaignReturnValue result = campaignService.mutate(operations);

    // Display campaigns.
    for (Campaign campaignResult : result.getValue()) {
      System.out.println("Campaign with name \"" + campaignResult.getName() + "\" and id \""
          + campaignResult.getId() + "\" was deleted.");
View Full Code Here

TOP

Related Classes of com.google.api.ads.adwords.axis.v201309.cm.CampaignServiceInterface

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.