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

Examples of com.google.api.adwords.v201309.cm.AdGroupAd


          ad.setDescription2("Second line of the description");
          ad.setHeadline("This is the headline " + generator.nextInt(5000));
          ad.setDisplayUrl("http://google.com/");
          ad.setUrl("http://example.com");

          AdGroupAd adGroupAd = new AdGroupAd();
          adGroupAd.setAd(ad);
          adGroupAd.setAdGroupId(adGroup.getId());

          adGroupAdService.mutate(new AdGroupAdOperation[] {new AdGroupAdOperation(Operator.ADD,
              "ADD", adGroupAd, null)});
        }

        numAds = generator.nextInt(10) + 1;
        for (int k = 0; k < numAds; k++) {
          ImageAd ad = new ImageAd();
          Image image = new Image();
          image.setData(DataUtils.getTestImage());
          image.setName("name.jpg");
          ad.setImage(image);
          ad.setDisplayUrl("http://google.com/");
          ad.setUrl("http://example.com");
          ad.setName("name.jpg");

          AdGroupAd adGroupAd = new AdGroupAd();
          adGroupAd.setAd(ad);
          adGroupAd.setAdGroupId(adGroup.getId());

          adGroupAdService.mutate(new AdGroupAdOperation[] {new AdGroupAdOperation(Operator.ADD,
              "ADD", adGroupAd, null)});
        }
View Full Code Here


    textAd.setDescription2("Low-gravity fun for everyone!");
    textAd.setDisplayUrl("www.example.com");
    textAd.setUrl("http://www.example.com");

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

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

    // Add ads.
    AdGroupAdReturnValue result = service.mutate(operations);
    AdGroupAd testAd = result.getValue()[0];

    // Set the generated fields.
    ad.getAd().setApprovalStatus(testAd.getAd().getApprovalStatus());
    ad.getAd().setAdType(testAd.getAd().getAdType());
    ad.getAd().setId(testAd.getAd().getId());
    ad.setStatus(testAd.getStatus());

    TestUtils.assertDeepReflectionEquals(ad, testAd);
  }
View Full Code Here

    // Create ad with updated status.
    Ad ad = new Ad();
    ad.setId(adId);

    // Create ad with updated status
    AdGroupAd adGroupAd = new AdGroupAd();
    adGroupAd.setAdGroupId(adGroupId);
    adGroupAd.setAd(ad);
    adGroupAd.setStatus(AdGroupAdStatus.PAUSED);

    // Create operations.
    AdGroupAdOperation operation = new AdGroupAdOperation();
    operation.setOperand(adGroupAd);
    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

    // Create ad with updated status.
    Ad ad = new Ad();
    ad.setId(adId);

    // Create ad with updated status
    AdGroupAd adGroupAd = new AdGroupAd();
    adGroupAd.setAdGroupId(adGroupId);
    adGroupAd.setAd(ad);
    adGroupAd.setStatus(AdGroupAdStatus.PAUSED);

    // Create operations.
    AdGroupAdOperation operation = new AdGroupAdOperation();
    operation.setOperand(adGroupAd);
    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

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

      exemptableTextAd.setDescription2("Low-gravity fun for everyone!");
      exemptableTextAd.setDisplayUrl("www.example.com");
      exemptableTextAd.setUrl("http://www.example.com/");

      // Create ad group ad.
      AdGroupAd exemptableAdGroupAd = new AdGroupAd();
      exemptableAdGroupAd.setAdGroupId(adGroupId);
      exemptableAdGroupAd.setAd(exemptableTextAd);

      // Create operations.
      AdGroupAdOperation exemptableOperation = new AdGroupAdOperation();
      exemptableOperation.setOperand(exemptableAdGroupAd);
      exemptableOperation.setOperator(Operator.ADD);

      // Create text ad that violates an non-exemptable policy.
      TextAd nonExemptableTextAd = new TextAd();
      nonExemptableTextAd.setHeadline("Mars Cruise with too long of a headline.");
      nonExemptableTextAd.setDescription1("Visit the Red Planet in style.");
      nonExemptableTextAd.setDescription2("Low-gravity fun for everyone.");
      nonExemptableTextAd.setDisplayUrl("www.example.com");
      nonExemptableTextAd.setUrl("http://www.example.com/");

      // Create ad group ad.
      AdGroupAd nonExemptableAdGroupAd = new AdGroupAd();
      nonExemptableAdGroupAd.setAdGroupId(adGroupId);
      nonExemptableAdGroupAd.setAd(nonExemptableTextAd);

      // Create operations.
      AdGroupAdOperation nonExemptableOperation = new AdGroupAdOperation();
      nonExemptableOperation.setOperand(nonExemptableAdGroupAd);
      nonExemptableOperation.setOperator(Operator.ADD);
View Full Code Here

        new TemplateElementField[] {headline, description1, description2, appId, appStore});

    clickToDownloadAppAd.setTemplateElements(new TemplateElement[] {adData});

    // Create the AdGroupAd.
    AdGroupAd clickToDownloadAppAdGroupAd = new AdGroupAd();
    clickToDownloadAppAdGroupAd.setAdGroupId(adGroupId);
    clickToDownloadAppAdGroupAd.setAd(clickToDownloadAppAd);

    // Optional: Set the status.
    clickToDownloadAppAdGroupAd.setStatus(AdGroupAdStatus.PAUSED);

    // Create the operation.
    AdGroupAdOperation operation = new AdGroupAdOperation();
    operation.setOperator(Operator.ADD);
    operation.setOperand(clickToDownloadAppAdGroupAd);
View Full Code Here

      // Create ad with updated status.
      Ad ad = new Ad();
      ad.setId(adId);

      AdGroupAd adGroupAd = new AdGroupAd();
      adGroupAd.setAdGroupId(adGroupId);
      adGroupAd.setAd(ad);
      adGroupAd.setStatus(AdGroupAdStatus.PAUSED);

      // Create operations.
      AdGroupAdOperation operation = new AdGroupAdOperation();
      operation.setOperand(adGroupAd);
      operation.setOperator(Operator.SET);
View Full Code Here

      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 image ad.
      ImageAd imageAd = new ImageAd();
      imageAd.setName("Cruise to mars image ad #" + System.currentTimeMillis());
      imageAd.setDisplayUrl("www.example.com");
      imageAd.setUrl("http://example.com");

      // Create image.
      Image image = new Image();
      image.setData(ImageUtils.getImageDataFromUrl("http://goo.gl/HJM3L"));
      imageAd.setImage(image);

      // Create ad group ad.
      AdGroupAd imageAdGroupAd = new AdGroupAd();
      imageAdGroupAd.setAdGroupId(adGroupId);
      imageAdGroupAd.setAd(imageAd);

      // Create template ad, using the Click to Play Video template (id 9).
      TemplateAd templateAd = new TemplateAd();
      templateAd.setTemplateId(9L);
      templateAd.setDimensions(new Dimensions(300, 250));
      templateAd.setName("Mars Cruise video ad #" + System.currentTimeMillis());
      templateAd.setDisplayUrl("www.example.com");
      templateAd.setUrl("http://www.example.com");

      // Create template ad data.
      Image startImage = new Image();
      startImage.setData(ImageUtils.getImageDataFromUrl("http://goo.gl/HJM3L"));
      startImage.setType(MediaMediaType.IMAGE);
      Video video = new Video();
      video.setMediaId(videoMediaId);
      video.setType(MediaMediaType.VIDEO);

      templateAd.setTemplateElements(new TemplateElement[] {
          new TemplateElement("adData", new TemplateElementField[] {
              new TemplateElementField("startImage", TemplateElementFieldType.IMAGE,
                  null, startImage),
              new TemplateElementField("displayUrlColor", TemplateElementFieldType.ENUM,
                  "#ffffff", null),
              new TemplateElementField("video", TemplateElementFieldType.VIDEO, null, video)})
      });

      // Create ad group ad.
      AdGroupAd templateAdGroupAd = new AdGroupAd();
      templateAdGroupAd.setAdGroupId(adGroupId);
      templateAdGroupAd.setAd(templateAd);

      // Create operations.
      AdGroupAdOperation textAdGroupAdOperation = new AdGroupAdOperation();
      textAdGroupAdOperation.setOperand(textAdGroupAd);
      textAdGroupAdOperation.setOperator(Operator.ADD);
View Full Code Here

      // Create base class ad to avoid setting type specific fields.
      Ad ad = new Ad();
      ad.setId(adId);

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

      // Create operations.
      AdGroupAdOperation operation = new AdGroupAdOperation();
      operation.setOperand(adGroupAd);
      operation.setOperator(Operator.REMOVE);
View Full Code Here

TOP

Related Classes of com.google.api.adwords.v201309.cm.AdGroupAd

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.