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

Examples of com.google.api.ads.adwords.jaxws.v201309.cm.BiddableAdGroupCriterion


    Keyword keyword = new Keyword();
    keyword.setText("mars cruise");
    keyword.setMatchType(KeywordMatchType.BROAD);

    // Create biddable ad group criterion.
    BiddableAdGroupCriterion criterion = new BiddableAdGroupCriterion();
    criterion.setAdGroupId(adGroupId);
    criterion.setCriterion(keyword);
    criterion.setUserStatus(UserStatus.PAUSED);
    criterion.setDestinationUrl("http://www.example.com");

    // Create bids.
    ManualCPCAdGroupCriterionBids bids = new ManualCPCAdGroupCriterionBids();
    bids.setMaxCpc(new Bid(new Money(null, 10000L)));
    criterion.setBids(bids);

    // Create operations.
    AdGroupCriterionOperation keywordAdGroupCriterionOperation = new AdGroupCriterionOperation();
    keywordAdGroupCriterionOperation.setOperand(criterion);
    keywordAdGroupCriterionOperation.setOperator(Operator.ADD);

    AdGroupCriterionOperation[] operations =
        new AdGroupCriterionOperation[] {keywordAdGroupCriterionOperation};

    // Add ad group criteria.
    AdGroupCriterionReturnValue result = service.mutate(operations);
    BiddableAdGroupCriterion testCriterion = (BiddableAdGroupCriterion) result.getValue()[0];

    // Exclude generated fields.
    criterion.getCriterion().setId(testCriterion.getCriterion().getId());
    criterion.getCriterion().setCriterionType(testCriterion.getCriterion().getCriterionType());
    criterion.setSystemServingStatus(testCriterion.getSystemServingStatus());
    criterion.setApprovalStatus(testCriterion.getApprovalStatus());
    criterion.setAdGroupCriterionType(testCriterion.getAdGroupCriterionType());
    criterion.getBids().setAdGroupCriterionBidsType(
        testCriterion.getBids().getAdGroupCriterionBidsType());
    ((ManualCPCAdGroupCriterionBids) criterion.getBids())
        .getMaxCpc()
        .getAmount()
        .setComparableValueType(
            (((ManualCPCAdGroupCriterionBids) testCriterion.getBids()).getMaxCpc().getAmount()
                .getComparableValueType()));
    ((ManualCPCAdGroupCriterionBids) criterion.getBids())
        .setBidSource((((ManualCPCAdGroupCriterionBids) testCriterion.getBids()).getBidSource()));
    ((ManualCPCAdGroupCriterionBids) criterion.getBids())
        .setMaxCpc(((ManualCPCAdGroupCriterionBids) testCriterion.getBids()).getMaxCpc());
    ((ManualCPCAdGroupCriterionBids) criterion.getBids())
        .setEnhancedCpcEnabled(((ManualCPCAdGroupCriterionBids) testCriterion.getBids())
            .getEnhancedCpcEnabled());
    criterion.setFirstPageCpc(testCriterion.getFirstPageCpc());
    criterion.setQualityInfo(testCriterion.getQualityInfo());
    criterion.setStats(testCriterion.getStats());

    TestUtils.assertDeepReflectionEquals(criterion, testCriterion);
  }
View Full Code Here


  /**
   * Test updating an ad group criterion.
   */
  public void testUpdate() throws Exception {
    // Create criterion with criterionId
    BiddableAdGroupCriterion criterion = new BiddableAdGroupCriterion();
    criterion.setAdGroupId(adGroupId);
    criterion.setCriterion(new Criterion(criterionId, null));
    criterion.setUserStatus(UserStatus.PAUSED);

    // Create operations.
    AdGroupCriterionOperation operation = new AdGroupCriterionOperation();
    operation.setOperand(criterion);
    operation.setOperator(Operator.SET);

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

    // Update ad group criteria.
    AdGroupCriterionReturnValue result = service.mutate(operations);
    BiddableAdGroupCriterion testCriterion = (BiddableAdGroupCriterion) result.getValue()[0];

    assertEquals(criterion.getUserStatus(), testCriterion.getUserStatus());
  }
View Full Code Here

  /**
   * Test removing ad group criterion.
   */
  public void testRemove() throws Exception {
    // Create criterion with criterionId
    BiddableAdGroupCriterion criterion = new BiddableAdGroupCriterion();
    criterion.setAdGroupId(adGroupId);
    criterion.setCriterion(new Criterion(criterionId, null));

    // Create operations.
    AdGroupCriterionOperation operation = new AdGroupCriterionOperation();
    operation.setOperand(criterion);
    operation.setOperator(Operator.SET);

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

    // Update ad group criteria.
    AdGroupCriterionReturnValue result = service.mutate(operations);
    BiddableAdGroupCriterion testCriterion = (BiddableAdGroupCriterion) result.getValue()[0];

    assertEquals(criterion.getCriterion().getId(), testCriterion.getCriterion().getId());
  }
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

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

        }
        Keyword keyword = new Keyword();
        keyword.setText(text);
        keyword.setMatchType(KeywordMatchType.BROAD);
        // Create BiddableAdGroupCriterion.
        BiddableAdGroupCriterion bagc = new BiddableAdGroupCriterion();
        bagc.setAdGroupId(adGroupId);
        bagc.setCriterion(keyword);
        // Create AdGroupCriterionOperation.
        AdGroupCriterionOperation agco = new AdGroupCriterionOperation();
        agco.setOperand(bagc);
        agco.setOperator(Operator.ADD);
        // Add to list.
View Full Code Here

      System.out.println("Ad group with name \"" + adGroup.getName() + "\" and id \""
          + adGroup.getId() + "\" was updated for the experiment.");

      // Set ad group criterion for the experiment.
      BiddableAdGroupCriterion adGroupCriterion = new BiddableAdGroupCriterion();
      adGroupCriterion.setCriterion(new Criterion(criterionId, null, null));
      adGroupCriterion.setAdGroupId(adGroupId);

      // Create experiment bid multiplier rule that will modify ad group bid for
      // the experiment.
      ManualCPCAdGroupCriterionExperimentBidMultiplier adGroupCriterionExperimentBidMultiplier =
          new ManualCPCAdGroupCriterionExperimentBidMultiplier();
      adGroupCriterionExperimentBidMultiplier.setMaxCpcMultiplier(new BidMultiplier(1.5, null));

      // Set experiment data to the ad group.
      BiddableAdGroupCriterionExperimentData adGroupCriterionExperimentData =
          new BiddableAdGroupCriterionExperimentData();
      adGroupCriterionExperimentData.setExperimentId(experimentId);
      adGroupCriterionExperimentData.setExperimentDeltaStatus(ExperimentDeltaStatus.MODIFIED);
      adGroupCriterionExperimentData
          .setExperimentBidMultiplier(adGroupCriterionExperimentBidMultiplier);
      adGroupCriterion.setExperimentData(adGroupCriterionExperimentData);

      // Create operation.
      AdGroupCriterionOperation adGroupCriterionOperation = new AdGroupCriterionOperation();
      adGroupCriterionOperation.setOperand(adGroupCriterion);
      adGroupCriterionOperation.setOperator(Operator.SET);

      // Update ad group criterion.
      adGroupCriterion =
          (BiddableAdGroupCriterion) adGroupCriterionService.mutate(
              new AdGroupCriterionOperation[] {adGroupCriterionOperation}).getValue()[0];

      System.out.println("Ad group criterion with ad group id \"" + adGroupCriterion.getAdGroupId()
          + "\" and criterion id \"" + adGroupCriterion.getCriterion().getId()
          + "\" was updated for the experiment.");
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
View Full Code Here

        Keyword keyword = new Keyword();
        keyword.setText(keywordText);
        keyword.setMatchType(KeywordMatchType.BROAD);

        // Create biddable ad group criterion.
        BiddableAdGroupCriterion keywordBiddableAdGroupCriterion = new BiddableAdGroupCriterion();
        keywordBiddableAdGroupCriterion.setAdGroupId(adGroupId);
        keywordBiddableAdGroupCriterion.setCriterion(keyword);

        // Create operation.
        AdGroupCriterionOperation keywordAdGroupCriterionOperation =
            new AdGroupCriterionOperation();
        keywordAdGroupCriterionOperation.setOperand(keywordBiddableAdGroupCriterion);
View Full Code Here

      Keyword keyword = new Keyword();
      keyword.setText("mars cruise");
      keyword.setMatchType(KeywordMatchType.BROAD);

      // Create biddable ad group criterion.
      BiddableAdGroupCriterion keywordBiddableAdGroupCriterion = new BiddableAdGroupCriterion();
      keywordBiddableAdGroupCriterion.setAdGroupId(adGroupId);
      keywordBiddableAdGroupCriterion.setCriterion(keyword);

      // Create placement.
      Placement placement = new Placement();
      placement.setUrl("http://mars.google.com");

      // Create biddable ad group criterion for placement.
      BiddableAdGroupCriterion placementBiddableAdGroupCriterion = new BiddableAdGroupCriterion();
      placementBiddableAdGroupCriterion.setAdGroupId(adGroupId);
      placementBiddableAdGroupCriterion.setCriterion(placement);

      // Create operations.
      AdGroupCriterionOperation keywordAdGroupCriterionOperation = new AdGroupCriterionOperation();
      keywordAdGroupCriterionOperation.setOperand(keywordBiddableAdGroupCriterion);
      keywordAdGroupCriterionOperation.setOperator(Operator.ADD);
View Full Code Here

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

      // Create biddable ad group criterion for gender
      Gender genderTarget = new Gender();
      genderTarget.setId(ID_FOR_MALE);
      BiddableAdGroupCriterion genderBiddableAdGroupCriterion = new BiddableAdGroupCriterion();
      genderBiddableAdGroupCriterion.setAdGroupId(adGroupId);
      genderBiddableAdGroupCriterion.setCriterion(genderTarget);

      // Create negative ad group criterion for age range
      AgeRange ageRangeNegative = new AgeRange();
      ageRangeNegative.setId(ID_FOR_18_TO_24);
      NegativeAdGroupCriterion ageRangeNegativeAdGroupCriterion = new NegativeAdGroupCriterion();
View Full Code Here

TOP

Related Classes of com.google.api.ads.adwords.jaxws.v201309.cm.BiddableAdGroupCriterion

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.