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

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


      CampaignCriterionOperation operation = new CampaignCriterionOperation();
      operation.setOperand(negativeCampaignCriterion);
      operation.setOperator(Operator.ADD);

      // Add campaign criteria.
      CampaignCriterionReturnValue result =
          campaignCriterionService.mutate(new CampaignCriterionOperation[] {operation});

      // Display campaign criteria.
      if (result != null && result.getValue() != null) {
        for (CampaignCriterion campaignCriterionResult : result.getValue()) {
          System.out.println("Campaign criterion with campaign id \""
              + campaignCriterionResult.getCampaignId() + "\", criterion id \""
              + campaignCriterionResult.getCriterion().getId() + "\", and type \""
              + campaignCriterionResult.getCriterion().getCriterionType() + "\" was added.");
        }
View Full Code Here


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

    // Get the CampaignCriterionService.
    CampaignCriterionServiceInterface campaignCriterionService =
        user.getService(AdWordsService.V201306.CAMPAIGN_CRITERION_SERVICE);

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

    // Create mobile platform. The ID can be found in the documentation.
    // https://developers.google.com/adwords/api/docs/appendix/platforms
    Platform mobile = new Platform();
    mobile.setId(30001L);

    CampaignCriterionOperation operation = new CampaignCriterionOperation();
    CampaignCriterion campaignCriterion = new CampaignCriterion();
    campaignCriterion.setCampaignId(campaignId);
    campaignCriterion.setCriterion(mobile);
    campaignCriterion.setBidModifier(1.5);
    operation.setOperand(campaignCriterion);
    operation.setOperator(Operator.SET);

    CampaignCriterionReturnValue result =
        campaignCriterionService.mutate(new CampaignCriterionOperation[] {operation});

    // Display campaign criteria.
    if (result != null && result.getValue() != null) {
      for (CampaignCriterion campaignCriterionResult : result.getValue()) {
        System.out.printf("Campaign criterion with campaign id '%s', criterion id '%s', "
View Full Code Here

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

      // Get the CampaignCriterionService.
      CampaignCriterionServiceInterface campaignCriterionService =
          user.getService(AdWordsService.V201306.CAMPAIGN_CRITERION_SERVICE);

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

      // Create keyword.
      Keyword keyword = new Keyword();
      keyword.setText("jupiter cruise");
      keyword.setMatchType(KeywordMatchType.BROAD);

      // Create negative campaign criterion.
      NegativeCampaignCriterion negativeCampaignCriterion = new NegativeCampaignCriterion();
      negativeCampaignCriterion.setCampaignId(campaignId);
      negativeCampaignCriterion.setCriterion(keyword);

      // Create operations.
      CampaignCriterionOperation operation = new CampaignCriterionOperation();
      operation.setOperand(negativeCampaignCriterion);
      operation.setOperator(Operator.ADD);

      // Add campaign criteria.
      CampaignCriterionReturnValue result =
          campaignCriterionService.mutate(new CampaignCriterionOperation[] {operation});

      // Display campaign criteria.
      if (result != null && result.getValue() != null) {
        for (CampaignCriterion campaignCriterionResult : result.getValue()) {
          System.out.println("Campaign criterion with campaign id \""
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

      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 \""
              + campaign.getId() + "\" was found.");
        }
      } else {
        System.out.println("No campaigns were found.");
View Full Code Here

      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 \""
              + campaignResult.getId() + "\", was updated to status " + campaignResult.getStatus());
        }
      } else {
        System.out.println("No campaigns were updated.");
View Full Code Here

      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.");
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

TOP

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

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.