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

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


      adGroupEstimateRequests.add(adGroupEstimateRequest);

      // Create campaign estimate requests.
      List<CampaignEstimateRequest> campaignEstimateRequests =
        new ArrayList<CampaignEstimateRequest>();
      CampaignEstimateRequest campaignEstimateRequest = new CampaignEstimateRequest();
      campaignEstimateRequest.setAdGroupEstimateRequests(
          adGroupEstimateRequests.toArray(new AdGroupEstimateRequest[]{}));
      Location unitedStates = new Location();
      unitedStates.setId(2840L);
      Language english = new Language();
      english.setId(1000L);
      campaignEstimateRequest.setCriteria(new Criterion[]{unitedStates, english});
      campaignEstimateRequests.add(campaignEstimateRequest);

      // Create selector.
      TrafficEstimatorSelector selector = new TrafficEstimatorSelector();
      selector.setCampaignEstimateRequests(
View Full Code Here


      if (result != null && result.getCampaignEstimates() != null) {
        KeywordEstimate[] keywordEstimates =
            result.getCampaignEstimates()[0].getAdGroupEstimates()[0].getKeywordEstimates();
        for (int i = 0; i < keywordEstimates.length; i++) {
          Keyword keyword = keywordEstimateRequests.get(i).getKeyword();
          KeywordEstimate keywordEstimate = keywordEstimates[i];
          if (Boolean.TRUE.equals(keywordEstimateRequests.get(i).getIsNegative())) {
            continue;
          }

          // Find the mean of the min and max values.
          double meanAverageCpc = (keywordEstimate.getMin().getAverageCpc().getMicroAmount()
              + keywordEstimate.getMax().getAverageCpc().getMicroAmount()) / 2.0;
          double meanAveragePosition = (keywordEstimate.getMin().getAveragePosition()
              + keywordEstimate.getMax().getAveragePosition()) / 2.0;
          double meanClicks = (keywordEstimate.getMin().getClicksPerDay()
              + keywordEstimate.getMax().getClicksPerDay()) / 2.0;
          double meanTotalCost = (keywordEstimate.getMin().getTotalCost().getMicroAmount()
              + keywordEstimate.getMax().getTotalCost().getMicroAmount()) / 2.0;

          System.out.println(String.format(
              "Results for the keyword with text '%s' and match type '%s':",
              keyword.getText(), keyword.getMatchType()));
          System.out.printf("\tEstimated average CPC: %.2f\n", meanAverageCpc);
View Full Code Here

      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);
View Full Code Here

      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);
View Full Code Here

    networkSetting.setTargetSearchNetwork(true);
    networkSetting.setTargetContentNetwork(true);
    campaign.setNetworkSetting(networkSetting);

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

    CampaignReturnValue result = campaignService.mutate(new CampaignOperation[] {operation});
    Campaign newCampaign = result.getValue(0);

    System.out.printf("Campaign with name '%s', ID %d and bidding scheme ID %d was created.\n",
View Full Code Here

      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.
View Full Code Here

      keywordMatch.setOptIn(Boolean.FALSE);

      campaign.setSettings(new Setting[] {geoTarget, keywordMatch});

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

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

      // Add campaign.
      CampaignReturnValue result = campaignService.mutate(operations);
View Full Code Here

      budget.setAmount(new Money(null, 50000000L));
      budget.setDeliveryMethod(BudgetBudgetDeliveryMethod.STANDARD);
      goodCampaign.setBudget(budget);

      // 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.biddingStrategy.
      badCampaign.setBiddingStrategyConfiguration(null);

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

      operations = new CampaignOperation[] {operation};

      try {
        // Validate campaign add operation.
View Full Code Here

      budget.setAmount(new Money(null, 50000000L));
      budget.setDeliveryMethod(BudgetBudgetDeliveryMethod.STANDARD);
      campaign.setBudget(budget);

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

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

      // Add campaign.
      CampaignReturnValue result = campaignService.mutate(operations);
View Full Code Here

      keywordMatch.setOptIn(Boolean.FALSE);

      campaign.setSettings(new Setting[] {geoTarget, keywordMatch});

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

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

      // Add campaign.
      CampaignReturnValue result = campaignService.mutate(operations);
View Full Code Here

TOP

Related Classes of com.google.api.adwords.v201306.cm.CampaignOperation

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.