Package com.google.api.adwords.v201306.cm

Examples of com.google.api.adwords.v201306.cm.CampaignServiceInterface


      AdGroup adGroup = new AdGroup();
      adGroup.setId(adGroupId);
      adGroup.setStatus(AdGroupStatus.DELETED);

      // Create operations.
      AdGroupOperation operation = new AdGroupOperation();
      operation.setOperand(adGroup);
      operation.setOperator(Operator.SET);

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

      // Delete ad group.
      AdGroupReturnValue result = adGroupService.mutate(operations);
View Full Code Here


      operation.setOperator(Operator.SET);

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

      // Delete ad group.
      AdGroupReturnValue result = adGroupService.mutate(operations);

      // Display ad groups.
      if (result != null && result.getValue() != null) {
        for (AdGroup adGroupResult : result.getValue()) {
          System.out.println("Ad group with name \"" + adGroupResult.getName() + "\" and id \""
              + adGroupResult.getId() + "\" was deleted.");
        }
      } else {
        System.out.println("No ad groups were deleted.");
View Full Code Here

      // Get AdWordsUser from "~/adwords.properties".
      AdWordsUser user = new AdWordsUser();

      // Get the AdGroupService.
      AdGroupServiceInterface adGroupService =
          user.getService(AdWordsService.V201306.ADGROUP_SERVICE);

      long adGroupId = Long.parseLong("INSERT_AD_GROUP_ID_HERE");

      // Create ad group with DELETED status.
      AdGroup adGroup = new AdGroup();
      adGroup.setId(adGroupId);
      adGroup.setStatus(AdGroupStatus.DELETED);

      // Create operations.
      AdGroupOperation operation = new AdGroupOperation();
      operation.setOperand(adGroup);
      operation.setOperator(Operator.SET);

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

      // Delete ad group.
      AdGroupReturnValue result = adGroupService.mutate(operations);

      // Display ad groups.
      if (result != null && result.getValue() != null) {
        for (AdGroup adGroupResult : result.getValue()) {
          System.out.println("Ad group with name \"" + adGroupResult.getName() + "\" and id \""
View Full Code Here

      // Get the GeoLocationService.
      GeoLocationServiceInterface geoLocationService =
          user.getService(AdWordsService.V201306.GEO_LOCATION_SERVICE);

      // Create addresses.
      Address address1 = new Address();
      address1.setStreetAddress("1600 Amphitheatre Pkwy");
      address1.setCityName("Mountain View");
      address1.setProvinceCode("US-CA");
      address1.setPostalCode("94043");
      address1.setCountryCode("US");

      Address address2 = new Address();
      address2.setStreetAddress("76 9th Ave");
      address2.setCityName("New York");
      address2.setProvinceCode("US-NY");
      address2.setPostalCode("10011");
      address2.setCountryCode("US");

      Address address3 = new Address();
      address3.setStreetAddress("五四大街1号, Beijing东城区");
      address3.setCountryCode("CN");

      // Create selector.
      GeoLocationSelector selector = new GeoLocationSelector();
      selector.setAddresses(new Address[] {address1, address2, address3});
View Full Code Here

      // Display ad group criteria.
      if (page.getEntries() != null && page.getEntries().length > 0) {
        for (AdGroupCriterion adGroupCriterion : page.getEntries()) {
          if (adGroupCriterion instanceof BiddableAdGroupCriterion) {
            BiddableAdGroupCriterion biddableAdGroupCriterion =
                (BiddableAdGroupCriterion) adGroupCriterion;
            System.out.println("Ad group criterion with ad group id \""
                + biddableAdGroupCriterion.getAdGroupId() + "\", criterion id \""
                + biddableAdGroupCriterion.getCriterion().getId() + "\", type \""
                + biddableAdGroupCriterion.getCriterion().getCriterionType()
                + "\", and user status \"" + biddableAdGroupCriterion.getUserStatus()
                + "\" was found.");
          }
        }
      } else {
        System.out.println("No ad group criteria were found.");
View Full Code Here

      // Get AdWordsUser from "~/adwords.properties".
      AdWordsUser user = new AdWordsUser();

      // Get the CampaignService.
      CampaignServiceInterface campaignService =
          user.getService(AdWordsService.V201306.CAMPAIGN_SERVICE);

      long campaignId = Long.parseLong("INSERT_CAMPAIGN_ID_HERE");

      // Create campaign with updated budget.
      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.
      if (result != null && result.getValue() != null) {
        for (Campaign campaignResult : result.getValue()) {
          System.out.println("Campaign with name \"" + campaignResult.getName() + "\", id \""
View Full Code Here

      // Get AdWordsUser from "~/adwords.properties".
      AdWordsUser user = new AdWordsUser();

      // Get the validation CampaignService.
      CampaignServiceInterface campaignValidationService =
          user.getValidationService(AdWordsService.V201306.CAMPAIGN_SERVICE);

      // Create campaign.
      Campaign goodCampaign = new Campaign();
      goodCampaign.setName("Campaign #" + System.currentTimeMillis());
      goodCampaign.setStatus(CampaignStatus.PAUSED);
      BiddingStrategyConfiguration biddingConfig = new BiddingStrategyConfiguration();
      ManualCpcBiddingScheme manualCpc = new ManualCpcBiddingScheme();
      manualCpc.setEnhancedCpcEnabled(false);
      biddingConfig.setBiddingScheme(manualCpc);
      goodCampaign.setBiddingStrategyConfiguration(biddingConfig);

      // Create budget.
      Budget budget = new Budget();
      budget.setPeriod(BudgetBudgetPeriod.DAILY);
      budget.setAmount(new Money(null, 50000000L));
      budget.setDeliveryMethod(BudgetBudgetDeliveryMethod.STANDARD);
      goodCampaign.setBudget(budget);

      KeywordMatchSetting keywordMatch = new KeywordMatchSetting();
      keywordMatch.setOptIn(Boolean.TRUE);
      goodCampaign.setSettings(new Setting[] {keywordMatch});
     
      // Create operations.
      CampaignOperation operation = new CampaignOperation();
      operation.setOperand(goodCampaign);
      operation.setOperator(Operator.ADD);

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

      // Validate campaign add operation.
      CampaignReturnValue result = campaignValidationService.mutate(operations);

      // Display new campaigns, which should be none if the service was a
      // validation service.
      if (result != null) {
        for (Campaign campaignResult : result.getValue()) {
          System.out.println("New campaign with name \"" + campaignResult.getName() + "\" and id \""
              + campaignResult.getId() + "\" was created.");
        }
      } else {
        System.out.println("No campaigns created.");
      }

      // Provide an invalid bidding strategy that will cause an exception
      // during validation.
      Campaign badCampaign = new Campaign();
      badCampaign.setName("Campaign #" + System.currentTimeMillis());
      badCampaign.setStatus(CampaignStatus.PAUSED);
      badCampaign.setBudget(budget);

      // Throws RequiredError.REQUIRED @ operations[0].operand.biddingStrategyConfiguration.
      badCampaign.setBiddingStrategyConfiguration(null);

      // Create operations.
      operation = new CampaignOperation();
      operation.setOperand(badCampaign);
      operation.setOperator(Operator.ADD);

      operations = new CampaignOperation[] {operation};

      try {
        // Validate campaign add operation.
        result = campaignValidationService.mutate(operations);
      } catch (ApiException e) {
        System.err.println("Validation failed for reason \"" + e.getMessage1() + "\".");
      }
    } catch (Exception e) {
      e.printStackTrace();
View Full Code Here

      // Get AdWordsUser from "~/adwords.properties".
      AdWordsUser user = new AdWordsUser();

      // Get the CampaignService.
      CampaignServiceInterface campaignService =
          user.getService(AdWordsService.V201306.CAMPAIGN_SERVICE);

      String query = "SELECT Id, Name, Status ORDER BY Name";
      // Get all campaigns.
      CampaignPage page = campaignService.query(query);

      // 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

      // Get AdWordsUser from "~/adwords.properties".
      AdWordsUser user = new AdWordsUser();

      // Get the CampaignService.
      CampaignServiceInterface campaignService =
          user.getService(AdWordsService.V201306.CAMPAIGN_SERVICE);

      long campaignId = Long.parseLong("INSERT_CAMPAIGN_ID_HERE");

      // 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.
      if (result != null && result.getValue() != null) {
        for (Campaign campaignResult : result.getValue()) {
          System.out.println("Campaign with name \"" + campaignResult.getName() + "\" and id \""
View Full Code Here

      // Get AdWordsUser from "~/adwords.properties".
      AdWordsUser user = new AdWordsUser();

      // Get the validation CampaignService.
      CampaignServiceInterface campaignService =
          user.getService(AdWordsService.V201306.CAMPAIGN_SERVICE);

      Long campaignId = Long.parseLong("INSERT_CAMPAIGN_ID_HERE");

      // Create selector.
      Selector selector = new Selector();
      selector.setFields(new String[] {"Id", "Name", "Eligible", "RejectionReasons"});

      // Create predicates.
      Predicate campaignIdPredicate =
          new Predicate("CampaignId", PredicateOperator.IN, new String[] {campaignId.toString()});
      selector.setPredicates(new Predicate[] {campaignIdPredicate});

      // Get campaigns.
      CampaignPage page = campaignService.get(selector);

      // Display campaigns.
      if (page.getEntries() != null) {
        for (Campaign campaign : page.getEntries()) {
          if (campaign.getConversionOptimizerEligibility().getEligible()) {
View Full Code Here

TOP

Related Classes of com.google.api.adwords.v201306.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.