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

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


    // Set the placement that the prospective line item will target.
    long[] targetedPlacementIds = new long[] {Long.parseLong("INSERT_PLACEMENT_ID_HERE")};

    // Create inventory targeting.
    InventoryTargeting inventoryTargeting =  new InventoryTargeting();
    inventoryTargeting.setTargetedPlacementIds(targetedPlacementIds);

    // Create targeting.
    Targeting targeting = new Targeting();
    targeting.setInventoryTargeting(inventoryTargeting);
View Full Code Here


    // Set the end date time to have the line line item run till.
    String endDateTime = "INSERT_END_DATE_TIME_HERE";

    // Create prospective line item.
    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.
    lineItem.setStartDateTimeType(StartDateTimeType.IMMEDIATELY);
    lineItem.setEndDateTime(DateTimeUtils.fromString(endDateTime));

    // Set the line item to use 50% of the impressions.
    lineItem.setUnitType(UnitType.IMPRESSIONS);
    lineItem.setUnitsBought(50L);

    // Set the cost type to match the unit type.
    lineItem.setCostType(CostType.CPM);

    // Get forecast for line item.
    Forecast forecast = forecastService.getForecast(lineItem);

    // Display results.
View Full Code Here

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

      // Get the InventoryService.
      InventoryServiceInterface inventoryService =
          user.getService(DfpService.V201211.INVENTORY_SERVICE);

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

      // Set the parent ad unit's ID for all ad units to be created under.
      String effectiveRootAdUnitId = networkService.getCurrentNetwork().getEffectiveRootAdUnitId();

      // Create local ad unit object.
      AdUnit adUnit = new AdUnit();
      adUnit.setName("Video_Ad_Unit");
      adUnit.setParentId(effectiveRootAdUnitId);
View Full Code Here

      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) {
        return new NumberValue(null, value.toString());
      } else if (value instanceof DateTime) {
        return new DateTimeValue(null, (DateTime) value);
      } else {
        throw new IllegalArgumentException("Unexpected Value type ["
            + value.getClass() + "]");
View Full Code Here

    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

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

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

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

      // Create a statement to only select predefined custom targeting keys.
      Statement filterStatement = new StatementBuilder("WHERE type = :type LIMIT 500").putValue(
          "type", CustomTargetingKeyType.PREDEFINED.toString()).toStatement();

      // Get custom targeting keys by statement.
      CustomTargetingKeyPage page =
          customTargetingService.getCustomTargetingKeysByStatement(filterStatement);
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.