Package com.google.api.ads.dfp.v201211

Examples of com.google.api.ads.dfp.v201211.Date


    // Create a statement to only select the root ad unit.
    Statement filterStatement = new Statement("WHERE parentId IS NULL LIMIT 500", null);

    // Get ad units by statement.
    AdUnitPage page = inventoryService.getAdUnitsByStatement(filterStatement);

    if (page.getResults() != null) {
      return page.getResults()[0];
    }

    return null;
  }
View Full Code Here


      adUnit.setTargetWindow(AdUnitTargetWindow.BLANK);
      adUnit.setExplicitlyTargeted(true);
      adUnit.setTargetPlatform(TargetPlatform.WEB);

      // Create master ad unit size.
      AdUnitSize masterAdUnitSize = new AdUnitSize();
      masterAdUnitSize.setSize(new Size(400, 300, false));
      masterAdUnitSize.setEnvironmentType(EnvironmentType.VIDEO_PLAYER);

      // Create companion sizes.
      AdUnitSize companionAdUnitSize1 = new AdUnitSize();
      companionAdUnitSize1.setSize(new Size(300, 250, false));
      companionAdUnitSize1.setEnvironmentType(EnvironmentType.BROWSER);

      AdUnitSize companionAdUnitSize2 = new AdUnitSize();
      companionAdUnitSize2.setSize(new Size(728, 90, false));
      companionAdUnitSize2.setEnvironmentType(EnvironmentType.BROWSER);

      // Add companions to master ad unit size.
      masterAdUnitSize.setCompanions(new AdUnitSize[] {companionAdUnitSize1, companionAdUnitSize2});

      // Set the size of possible creatives that can match this ad unit.
View Full Code Here

      AdUnitSize[] adUnitSizes = inventoryService.getAdUnitSizesByStatement(filterStatement);

      // Display results.
      if (adUnitSizes != null) {
        for (int i = 0; i < adUnitSizes.length; i++) {
          AdUnitSize adUnitSize = adUnitSizes[i];
          System.out.printf("%s) Web ad unit size of dimensions %s was found.\n", i,
              adUnitSize.getFullDisplayString());
        }
      } else {
        System.out.println("No ad unit sizes found.");
      }
    } catch (Exception e) {
View Full Code Here

      return (Value) value;
    } else if (value == null) {
      return new TextValue(null, null);
    } else {
      if (value instanceof Boolean) {
        return new BooleanValue(null, (Boolean) value);
      } else if (value instanceof Double) {
        return new NumberValue(null, value.toString());
      } else if (value instanceof String) {
        return new TextValue(null, (String) value);
      } else if (value instanceof Long) {
View Full Code Here

      // Get the custom targeting value ID for the comedy category.
      long categoryCustomTargetingValueId = customTargetingValuePage.getResults()[0].getId();

      // Set defaults for page and filterStatement.
      ContentPage page = new ContentPage();
      Statement filterStatement = new Statement();
      int offset = 0;

      do {
        // Create a statement to get all active content.
        filterStatement.setQuery("WHERE status = 'ACTIVE' LIMIT 500 OFFSET " + offset);

        // Get content by statement.
        page = contentService.getContentByStatementAndCustomTargetingValue(filterStatement,
            categoryCustomTargetingValueId);

        if (page.getResults() != null) {
          int i = page.getStartIndex();
          for (Content content : page.getResults()) {
            System.out.println(i + ") Content with ID \"" + content.getId()
                + "\", name \"" + content.getName()
                + "\", and status \"" + content.getStatus() + "\" was found.");
            i++;
          }
        }

        offset += 500;
      } while (offset < page.getTotalResultSetSize());

      System.out.println("Number of results found: " + page.getTotalResultSetSize());
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
View Full Code Here

      // Get the ContentService.
      ContentServiceInterface contentService = user.getService(DfpService.V201211.CONTENT_SERVICE);

      // Set defaults for page and filterStatement.
      ContentPage page = new ContentPage();
      Statement filterStatement = new Statement();
      int offset = 0;

      do {
        // Create a statement to get all content.
        filterStatement.setQuery("LIMIT 500 OFFSET " + offset);

        // Get content by statement.
        page = contentService.getContentByStatement(filterStatement);

        if (page.getResults() != null) {
          int i = page.getStartIndex();
          for (Content content : page.getResults()) {
            System.out.println(i + ") Content with ID \"" + content.getId()
                + "\", name \"" + content.getName()
                + "\", and status \"" + content.getStatus() + "\" was found.");
            i++;
          }
        }

        offset += 500;
      } while (offset < page.getTotalResultSetSize());

      System.out.println("Number of results found: " + page.getTotalResultSetSize());
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
View Full Code Here

      // Get DfpUser from "~/dfp.properties".
      DfpUser user = new DfpUser();

      // Get the ContentService.
      ContentServiceInterface contentService = user.getService(DfpService.V201211.CONTENT_SERVICE);

      // Get the NetworkService.
      NetworkServiceInterface networkService = user.getService(DfpService.V201211.NETWORK_SERVICE);

      // Get the CustomTargetingService.
      CustomTargetingServiceInterface customTargetingService =
          user.getService(DfpService.V201211.CUSTOM_TARGETING_SERVICE);

      // Get content browse custom targeting key ID.
      long contentBrowseCustomTargetingKeyId =
          networkService.getCurrentNetwork().getContentBrowseCustomTargetingKeyId();

      // Create a statement to select the categories matching the name comedy.
      Statement categoryFilterStatement = new StatementBuilder(
          "WHERE customTargetingKeyId = :contentBrowseCustomTargetingKeyId " +
          " and name = :category LIMIT 1")
          .putValue("contentBrowseCustomTargetingKeyId", contentBrowseCustomTargetingKeyId)
          .putValue("category", "comedy").toStatement();

      // Get categories matching the filter statement.
      CustomTargetingValuePage customTargetingValuePage =
          customTargetingService.getCustomTargetingValuesByStatement(categoryFilterStatement);

      // Get the custom targeting value ID for the comedy category.
      long categoryCustomTargetingValueId = customTargetingValuePage.getResults()[0].getId();

      // Set defaults for page and filterStatement.
      ContentPage page = new ContentPage();
      Statement filterStatement = new Statement();
      int offset = 0;

      do {
        // Create a statement to get all active content.
        filterStatement.setQuery("WHERE status = 'ACTIVE' LIMIT 500 OFFSET " + offset);

        // Get content by statement.
        page = contentService.getContentByStatementAndCustomTargetingValue(filterStatement,
            categoryCustomTargetingValueId);

        if (page.getResults() != null) {
          int i = page.getStartIndex();
          for (Content content : page.getResults()) {
View Full Code Here

      // Get DfpUser from "~/dfp.properties".
      DfpUser user = new DfpUser();

      // Get the ContentService.
      ContentServiceInterface contentService = user.getService(DfpService.V201211.CONTENT_SERVICE);

      // Set defaults for page and filterStatement.
      ContentPage page = new ContentPage();
      Statement filterStatement = new Statement();
      int offset = 0;

      do {
        // Create a statement to get all content.
        filterStatement.setQuery("LIMIT 500 OFFSET " + offset);

        // Get content by statement.
        page = contentService.getContentByStatement(filterStatement);

        if (page.getResults() != null) {
          int i = page.getStartIndex();
          for (Content content : page.getResults()) {
            System.out.println(i + ") Content with ID \"" + content.getId()
View Full Code Here

    LineItem lineItem = new LineItem();
    lineItem.setLineItemType(LineItemType.SPONSORSHIP);
    lineItem.setTargeting(targeting);

    // Create the creative placeholder.
    CreativePlaceholder creativePlaceholder = new CreativePlaceholder();
    creativePlaceholder.setSize(new Size(300, 250, false));

    // Set the size of creatives that can be associated with this line item.
    lineItem.setCreativePlaceholders(new CreativePlaceholder[] {creativePlaceholder});

    // Set the line item's time to be now until the projected end date time.
View Full Code Here

          user.getService(DfpService.V201211.CREATIVE_WRAPPER_SERVICE);

      Long labelId = Long.parseLong("INSERT_CREATIVE_WRAPPER_LABEL_ID_HERE");
     
      // Create a creative wrapper.
      CreativeWrapper creativeWrapper1 = new CreativeWrapper();
      // A label can only be associated with one creative wrapper.
      creativeWrapper1.setLabelId(labelId);
      creativeWrapper1.setOrdering(CreativeWrapperOrdering.INNER);
      creativeWrapper1.setHeader(
          new CreativeWrapperHtmlSnippet("<b>My creative wrapper header</b>"));
      creativeWrapper1.setFooter(
          new CreativeWrapperHtmlSnippet("<b>My creative wrapper footer</b>"));

      // Create the creative wrappers on the server.
      CreativeWrapper[] creativeWrappers =
          creativeWrapperService.createCreativeWrappers(new CreativeWrapper[] {creativeWrapper1});
View Full Code Here

TOP

Related Classes of com.google.api.ads.dfp.v201211.Date

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.