Package com.google.api.ads.dfp.axis.v201308

Examples of com.google.api.ads.dfp.axis.v201308.Date


    // Get the ContentService.
    ContentServiceInterface contentService =
        dfpServices.get(session, ContentServiceInterface.class);

    // Get the CustomTargetingService.
    CustomTargetingServiceInterface customTargetingService =
        dfpServices.get(session, CustomTargetingServiceInterface.class);

    // Get the NetworkService.
    NetworkServiceInterface networkService =
        dfpServices.get(session, NetworkServiceInterface.class);

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

    if (contentBrowseCustomTargetingKeyId == 0) {
      throw new RuntimeException("Your network does not have content categories enabled.");     
    }

    // Create a statement to select the categories matching the name comedy.
    Statement categoryFilterStatement = new StatementBuilder()
        .where("customTargetingKeyId = :contentBrowseCustomTargetingKeyId and name = :category")
        .limit(1)
        .withBindVariableValue(
            "contentBrowseCustomTargetingKeyId", contentBrowseCustomTargetingKeyId)
        .withBindVariableValue("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();

    // Create a statement to select all content.
View Full Code Here


      int totalResultSetSize = 0;
      statementBuilder.offset(0);

      do {
        // Get custom targeting values by statement.
        CustomTargetingValuePage page =
            customTargetingService.getCustomTargetingValuesByStatement(
                statementBuilder.toStatement());

        if (page.getResults() != null) {
          totalResultSetSize = page.getTotalResultSetSize();
          for (CustomTargetingValue customTargetingValue : page.getResults()) {
            System.out.printf("%d) Custom targeting value with ID \"%d\", belonging to key "
                + "with ID \"%d\", name \"%s\" and display name \"%s\" was found.\n",
                totalResultsCounter++,
                customTargetingValue.getId(),
                customTargetingValue.getCustomTargetingKeyId(),
View Full Code Here

    numberValue3 = new NumberValue();
    numberValue3.setValue("-1");

    dateTime1 = new DateTime();
    date1 = new Date();
    date1.setYear(2012);
    date1.setMonth(12);
    date1.setDay(2);
    dateTime1.setDate(date1);
    dateTime1.setHour(12);
View Full Code Here

    if (totalResultSetSize > 0) {
      // Remove limit and offset from statement.
      statementBuilder.removeLimitAndOffset();

      // Create action.
      DeactivateLineItemCreativeAssociations action = new DeactivateLineItemCreativeAssociations();

      // Perform action.
      UpdateResult result = licaService.performLineItemCreativeAssociationAction(
          action, statementBuilder.toStatement());
View Full Code Here

    // Get the root ad unit ID used to target the whole site.
    String rootAdUnitId = networkService.getCurrentNetwork().getEffectiveRootAdUnitId();

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

    // Create ad unit targeting for the root ad unit (i.e. the whole network).
    AdUnitTargeting adUnitTargeting = new AdUnitTargeting();
    adUnitTargeting.setAdUnitId(rootAdUnitId);
    adUnitTargeting.setIncludeDescendants(true);

    inventoryTargeting.setTargetedAdUnits(new AdUnitTargeting[] {adUnitTargeting});

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

    // Default for total result set size.
    int totalResultSetSize = 0;

    do {
      // Get labels by statement.
      LabelPage page =
          labelService.getLabelsByStatement(statementBuilder.toStatement());

      if (page.getResults() != null) {
        totalResultSetSize = page.getTotalResultSetSize();
        int i = page.getStartIndex();
        for (Label label : page.getResults()) {
          System.out.printf(
              "%d) Label with ID \"%d\" and name \"%s\" was found.\n", i++,
              label.getId(), label.getName());
        }
      }
View Full Code Here

*/
public class GetActiveLabels {

  public static void runExample(DfpServices dfpServices, DfpSession session) throws Exception {
    // Get the LabelService.
    LabelServiceInterface labelService =
        dfpServices.get(session, LabelServiceInterface.class);

    // Create a statement to only select active labels.
    StatementBuilder statementBuilder = new StatementBuilder()
        .where("isActive = :isActive")
        .orderBy("id ASC")
        .limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
        .withBindVariableValue("isActive", true);

    // Default for total result set size.
    int totalResultSetSize = 0;

    do {
      // Get labels by statement.
      LabelPage page =
          labelService.getLabelsByStatement(statementBuilder.toStatement());

      if (page.getResults() != null) {
        totalResultSetSize = page.getTotalResultSetSize();
        int i = page.getStartIndex();
        for (Label label : page.getResults()) {
View Full Code Here

    // Set the custom targeting.
    targeting.setCustomTargeting(topCustomCriteriaSet);

    // Create a line item.
    LineItem lineItem = new LineItem();
    lineItem.setName("Line item #" + new Random().nextInt(Integer.MAX_VALUE));
    lineItem.setOrderId(orderId);
    lineItem.setTargeting(targeting);

    // Allow the line item to be booked even if there is not enough inventory.
    lineItem.setAllowOverbook(true);

    // Set the line item type to STANDARD and priority to High. In this case,
    // 8 would be Normal, and 10 would be Low.
    lineItem.setLineItemType(LineItemType.STANDARD);
    lineItem.setPriority(6);

    // Set the creative rotation type to even.
    lineItem.setCreativeRotationType(CreativeRotationType.EVEN);

    // Create creative placeholder size.
    Size size = new Size();
    size.setWidth(300);
    size.setHeight(250);
    size.setIsAspectRatio(false);

    // Create the creative placeholder.
    CreativePlaceholder creativePlaceholder = new CreativePlaceholder();
    creativePlaceholder.setSize(size);

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

    // Set the length of the line item to run.
    lineItem.setStartDateTimeType(StartDateTimeType.IMMEDIATELY);
    lineItem.setEndDateTime(
        DateTimes.toDateTime(Instant.now().plus(Duration.standardDays(30L)), "America/New_York"));

    // Set the cost per unit to $2.
    lineItem.setCostType(CostType.CPM);
    lineItem.setCostPerUnit(new Money("USD", 2000000L));

    // Set the number of units bought to 500,000 so that the budget is
    // $1,000.
    lineItem.setUnitsBought(500000L);
    lineItem.setUnitType(UnitType.IMPRESSIONS);

    // Create the line item on the server.
    LineItem[] lineItems = lineItemService.createLineItems(new LineItem[] {lineItem});

    for (LineItem createdLineItem : lineItems) {
View Full Code Here

    // Get the LineItemCreativeAssociationService.
    LineItemCreativeAssociationServiceInterface licaService =
        dfpServices.get(session, LineItemCreativeAssociationServiceInterface.class);

    // Get the LICA.
    LineItemCreativeAssociation lica =
        licaService.getLineItemCreativeAssociation(lineItemId, creativeId);

    // Update the destination URL.
    lica.setDestinationUrl("http://news.google.com?newTrackingParameter");

    // Update the LICA on the server.
    LineItemCreativeAssociation[] licas =
        licaService.updateLineItemCreativeAssociations(new LineItemCreativeAssociation[] {lica});
View Full Code Here

    // Default for total result set size.
    int totalResultSetSize = 0;

    do {
      // Get LICAs by statement.
      LineItemCreativeAssociationPage page =
          licaService.getLineItemCreativeAssociationsByStatement(statementBuilder.toStatement());

      if (page.getResults() != null) {
        totalResultSetSize = page.getTotalResultSetSize();
        int i = page.getStartIndex();
        for (LineItemCreativeAssociation lica : page.getResults()) {
          if (lica.getCreativeSetId() != null) {
            System.out.printf("%d) LICA with line item ID \"%d\" and creative "
                + "set ID \"%d\" will be deactivated.\n", i++, lica.getLineItemId(),
                lica.getCreativeSetId());
          } else {
View Full Code Here

TOP

Related Classes of com.google.api.ads.dfp.axis.v201308.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.