Package com.google.api.adwords.v201008.cm

Examples of com.google.api.adwords.v201008.cm.AdExtensionOverrideOperation


    operation.setOperator(Operator.SET);

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

    // Update ad.
    AdGroupAdReturnValue result = service.mutate(operations);
    AdGroupAd testAdGroupAd = result.getValue()[0];

    assertEquals(adGroupAd.getStatus(), testAdGroupAd.getStatus());
  }
View Full Code Here


    operation.setOperator(Operator.REMOVE);

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

    // Remove ad.
    AdGroupAdReturnValue result = service.mutate(operations);
    AdGroupAd testAdGroupAd = result.getValue()[0];

    assertEquals(AdGroupAdStatus.DISABLED, testAdGroupAd.getStatus());
  }
View Full Code Here

  /**
   * Test getting an ad group ad.
   */
  public void testGet() throws Exception {
    // Create ad selector.
    AdGroupAdSelector selector = new AdGroupAdSelector();
    selector.setAdIds(new long[] {adId});

    // Create date range.
    DateRange range = new DateRange(TestUtils.firstDayOfMonth(), TestUtils.today());
    selector.setStatsSelector(new AdStatsSelector(range, null));

    // Get ads with the selector created above.
    AdGroupAdPage page = service.get(selector);

    assertNotNull(page);
View Full Code Here

  /**
   * Test getting all ad group ads in an ad group.
   */
  public void testGetAllInAdGroup() throws Exception {
    // Create ad selector.
    AdGroupAdSelector selector = new AdGroupAdSelector();
    selector.setAdGroupIds(new long[] {adGroupId});

    // Get ads with the selector created above.
    AdGroupAdPage page = service.get(selector);

    assertNotNull(page);
View Full Code Here

  /**
   * Test getting all ad group ads in an ad group.
   */
  public void testGetAllInCampaign() throws Exception {
    // Create ad selector.
    AdGroupAdSelector selector = new AdGroupAdSelector();
    selector.setCampaignIds(new long[] {campaignId});

    // Get ads with the selector created above.
    AdGroupAdPage page = service.get(selector);

    assertNotNull(page);
View Full Code Here

  /**
   * Test getting all ad group ads.
   */
  public void testGetAll() throws Exception {
    // Get ads with a created selector.
    AdGroupAdSelector selector = new AdGroupAdSelector();
    AdGroupAdPage page = service.get(selector);

    assertNotNull(page);
    assertNotNull(page.getEntries());
    assertTrue("Expected at least 1 entry", page.getTotalNumEntries() >= 1);
View Full Code Here

   * @param adGroupId the id of the parent ad group
   * @return the id of the created ad
   */
  public long createTextAd(long adGroupId) throws Exception {
    // Get the AdGroupAdService.
    AdGroupAdServiceInterface adGroupAdService =
        user.getService(AdWordsService.V201008.ADGROUP_AD_SERVICE);

    // Create text ad.
    TextAd textAd = new TextAd();
    textAd.setHeadline("Luxury Cruise to Mars");
    textAd.setDescription1("Visit the Red Planet in style.");
    textAd.setDescription2("Low-gravity fun for everyone!");
    textAd.setDisplayUrl("www.example.com");
    textAd.setUrl("http://www.example.com");

    // Create ad group ad.
    AdGroupAd textAdGroupAd = new AdGroupAd();
    textAdGroupAd.setAdGroupId(adGroupId);
    textAdGroupAd.setAd(textAd);

    // Create operations.
    AdGroupAdOperation textAdGroupAdOperation = new AdGroupAdOperation();
    textAdGroupAdOperation.setOperand(textAdGroupAd);
    textAdGroupAdOperation.setOperator(Operator.ADD);
    AdGroupAdOperation[] operations = new AdGroupAdOperation[] {textAdGroupAdOperation};

    // Add new TextAd and return its ID.
    return adGroupAdService.mutate(operations).getValue()[0].getAd().getId();
  }
View Full Code Here

    BiddableAdGroupCriterion placementBiddableAdGroupCriterion = new BiddableAdGroupCriterion();
    placementBiddableAdGroupCriterion.setAdGroupId(adGroupId);
    placementBiddableAdGroupCriterion.setCriterion(placement);

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

    AdGroupCriterionOperation placementAdGroupCriterionOperation = new AdGroupCriterionOperation();
    placementAdGroupCriterionOperation.setOperand(placementBiddableAdGroupCriterion);
    placementAdGroupCriterionOperation.setOperator(Operator.ADD);

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

    // Add ad group criteria and return Criterion ID.
View Full Code Here

   * @param adGroupId the id of the parent ad group
   * @return the id of the created criterion
   */
  public long createKeyword(long adGroupId) throws Exception {
    // Get the AdGroupCriterionService.
    AdGroupCriterionServiceInterface adGroupCriterionService =
        user.getService(AdWordsService.V201008.ADGROUP_CRITERION_SERVICE);

    // Create keyword.
    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);

    AdGroupCriterionOperation placementAdGroupCriterionOperation = new AdGroupCriterionOperation();
    placementAdGroupCriterionOperation.setOperand(placementBiddableAdGroupCriterion);
    placementAdGroupCriterionOperation.setOperator(Operator.ADD);

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

    // Add ad group criteria and return Criterion ID.
    return adGroupCriterionService.mutate(operations).getValue()[0].getCriterion().getId();
  }
View Full Code Here

    ManualCPCAdGroupBids adGroupBids = new ManualCPCAdGroupBids();
    adGroupBids.setKeywordMaxCpc(new Bid(new Money(null, 10000000L)));
    adGroup.setBids(adGroupBids);

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

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

    // Add ad group and return AdGroup ID.
    return adGroupService.mutate(operations).getValue()[0].getId();
View Full Code Here

TOP

Related Classes of com.google.api.adwords.v201008.cm.AdExtensionOverrideOperation

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.