Reminder: v201611 will be sunset on November 30, 2017.

DFP Sales Manager Proposal Line Items

This guide explains ‘what a proposal line item is‘ and walks you through the creation of a ProposalLineItem object via the API. It covers the required fields and discusses the next steps once you have created your proposal line items under a Proposal object.

Primer

What is a proposal line item? In the DFP Sales Manager UI, you have a catalog of Product objects which represent generic templates of allowed or pre-set definitions for targeting. These already paired with the RateCard objects which allow for PremiumRate objects to be applied to the pricing. When you populate the other requisite billing and delivery fields, you are effectively creating the ProposalLineItem object, nested below the Proposal objects, which represent line item objects before the trafficking stage within DFP.

Creating a proposal line item via the API

To create a propsal line item in the API, you must have:

  • a Proposal to associate the proposal line item with
  • a RateCard you wish to price the proposal line item with
  • a Product to base it off of

Start by creating a ProposalLineItem object locally and assigning it a name.

Java


  // Get the ProposalLineItemService.
  ProposalLineItemServiceInterface proposalLineItemService =
      dfpServices.get(session, ProposalLineItemServiceInterface.class);

  // Create a proposal line item.
  ProposalLineItem proposalLineItem = new ProposalLineItem();
  proposalLineItem.setName("Proposal line item #" + new Random().nextInt(Integer.MAX_VALUE));
    

Python


  # Initialize appropriate service.
  proposal_line_item_service = client.GetService(
      'ProposalLineItemService', version='v201705')

  # Create a single proposal line item.
  proposal_line_item = {
      'name': 'Proposal line item #%s' % uuid.uuid4(),
      ...
    

PHP


    $proposalLineItemService =
        $dfpServices->get($session, ProposalLineItemService::class);

    // Create a standard proposal line item.
    $proposalLineItem = new ProposalLineItem();
    $proposalLineItem->setName('Proposal line item #' . uniqid());
    $proposalLineItem->setLineItemType(LineItemType::STANDARD);
    

C#


  // Get the ProposalLineItemService.
  ProposalLineItemService proposalLineItemService =
      (ProposalLineItemService) user.GetService(DfpService.v201705.ProposalLineItemService);

  // Create a proposal line item.
  ProposalLineItem proposalLineItem = new ProposalLineItem();
  proposalLineItem.name = "Proposal line item #" + new Random().Next(int.MaxValue);
    

Once you’ve created the proposal line item locally, you can then associate it with your proposal, and set the product and rate card from which to inherit targeting and pricing, respectively.

Java


  proposalLineItem.setProposalId(proposalId);
  proposalLineItem.setRateCardId(rateCardId);
  proposalLineItem.setProductId(productId);
  proposalLineItem.setTargeting(targeting);
    

Python


      ...
      'rateCardId': rate_card_id,
      'productId': product_id,
      'proposalId': proposal_id,
      ...
    

PHP


    $proposalLineItem->setProposalId($proposalId);
    $proposalLineItem->setRateCardId($rateCardId);
    $proposalLineItem->setProductId($productId);
    

C#


  proposalLineItem.proposalId = proposalId;
  proposalLineItem.rateCardId = rateCardId;
  proposalLineItem.productId = productId;
  proposalLineItem.targeting = targeting;
    

Proposal line items support targeting fields the same way that LineItem objects do, similarly, they require an InventoryTargeting object at minimum. In this case, a Run-of-Network proposal line item will be created by targeting the root ad unit of the network.

Java


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

  // 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);
    

Python


      ...
      'targeting': {
          'inventoryTargeting': {
              'targetedAdUnits': {
                  'adUnitId': root_ad_unit_id
              }
          }
      },
      ...
    

PHP


    // Create ad unit targeting for the root ad unit (i.e. the whole network).
    $rootAdUnitId =
        $networkService->getCurrentNetwork()->getEffectiveRootAdUnitId();
    $inventoryTargeting = new InventoryTargeting();
    $adUnitTargeting = new AdUnitTargeting();
    $adUnitTargeting->setAdUnitId($rootAdUnitId);
    $adUnitTargeting->setIncludeDescendants(true);
    $inventoryTargeting->setTargetedAdUnits([$adUnitTargeting]);
    $targeting = new Targeting();
    $targeting->setInventoryTargeting($inventoryTargeting);
    $proposalLineItem->setTargeting($targeting);
    

C#


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

  // 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.adUnitId = rootAdUnitId;
  adUnitTargeting.includeDescendants = true;

  inventoryTargeting.targetedAdUnits = new AdUnitTargeting[] {adUnitTargeting};

  // Create targeting.
  Targeting targeting = new Targeting();
  targeting.inventoryTargeting = inventoryTargeting;
    

Once the required InventoryTargeting object has been added, you would have to specify the start and end date times for the prospective line item to serve, as well as the delivery information set on the Goal object.

Java


  // Set the length of the proposal line item to run.
  proposalLineItem.setStartDateTime(DateTimes.toDateTime(Instant.now(), "America/New_York"));
  proposalLineItem.setEndDateTime(
      DateTimes.toDateTime(Instant.now().plus(Duration.standardDays(30L)), "America/New_York"));
  // Set pricing for the proposal line item for 1000 impressions at a CPM of $2
  // for a total value of $2.
  Goal goal = new Goal();
  goal.setUnits(1000L);
  goal.setUnitType(UnitType.IMPRESSIONS);
  proposalLineItem.setGoal(goal);
  proposalLineItem.setNetCost(new Money("USD", 2000000L));
  proposalLineItem.setNetRate(new Money("USD", 2000000L));
  proposalLineItem.setRateType(RateType.CPM);
  // Set delivery specifications for the proposal line item.
  proposalLineItem.setDeliveryRateType(DeliveryRateType.EVENLY);
  proposalLineItem.setCreativeRotationType(CreativeRotationType.OPTIMIZED);
    

Python


      ...
      'startDateTime': start_datetime,
      'endDateTime': end_datetime,
      'goal': {
          'units': '1000',
          'unitType': 'IMPRESSIONS',
      },
      'netCost': {
          'currencyCode': 'USD',
          'microAmount': '2000000'
      },
      'netRate': {
          'currencyCode': 'USD',
          'microAmount': '2000000'
      },
      'rateType': 'CPM',
      'deliveryRateType': 'EVENLY',
      'creativeRotationType': 'OPTIMIZED',
      ...
    

PHP


    // Set the length of the proposal line item to run.
    $proposalLineItem->setStartDateTime(DfpDateTimes::fromDateTime(
        new DateTime('now', new DateTimeZone('America/New_York'))));
    $proposalLineItem->setEndDateTime(DfpDateTimes::fromDateTime(
        new DateTime('+1 month', new DateTimeZone('America/New_York'))));
    // Set pricing for the proposal line item for 1000 impressions at a CPM of
    // $2 for a total value of $2.
    $goal = new Goal();
    $goal->setUnits(1000);
    $goal->setUnitType(UnitType::IMPRESSIONS);
    $proposalLineItem->setGoal($goal);
    $proposalLineItem->setNetCost(new Money('USD', 2000000));
    $proposalLineItem->setNetRate(new Money('USD', 2000000));
    $proposalLineItem->setRateType(RateType::CPM);
    // Set delivery specifications for the proposal line item.
    $proposalLineItem->setDeliveryRateType(DeliveryRateType::EVENLY);
    $proposalLineItem->setCreativeRotationType(CreativeRotationType::OPTIMIZED);
    

C#


  // Set the length of the proposal line item to run.
  proposalLineItem.startDateTime =
      DateTimeUtilities.FromDateTime(System.DateTime.Now.AddDays(7), "America/New_York");
  proposalLineItem.endDateTime =
      DateTimeUtilities.FromDateTime(System.DateTime.Now.AddDays(30), "America/New_York");
  // Set pricing for the proposal line item for 1000 impressions at a CPM of $2
  // for a total value of $2.
  proposalLineItem.goal = new Goal() {unitType = UnitType.IMPRESSIONS, units = 1000L};
  proposalLineItem.netCost = new Money() {currencyCode = "USD", microAmount = 2000000L};
  proposalLineItem.netRate = new Money() {currencyCode = "USD", microAmount = 2000000L};
  proposalLineItem.rateType = RateType.CPM;
  // Set delivery specifications for the proposal line item.
  proposalLineItem.deliveryRateType = DeliveryRateType.EVENLY;
  proposalLineItem.creativeRotationType = CreativeRotationType.OPTIMIZED;
    

Proposal line items also allow you to override the billing information that normally gets inherited from the proposal. You can set the same BillingCap, BillingSource, and BillingSchedule fields that the Proposal object allows for.

Java


  // Set billing specifications for the proposal line item.
  proposalLineItem.setBillingCap(BillingCap.CAPPED_CUMULATIVE);
  proposalLineItem.setBillingSource(BillingSource.THIRD_PARTY_VOLUME);
    

Python


      ...
      'billingCap': 'CAPPED_CUMULATIVE',
      'billingSource': 'THIRD_PARTY_VOLUME',
      ...
    

PHP


    // Set billing specifications for the proposal line item.
    $proposalLineItem->setBillingCap(BillingCap::CAPPED_CUMULATIVE);
    $proposalLineItem->setBillingSource(BillingSource::THIRD_PARTY_VOLUME);
    

C#


  // Set billing specifications for the proposal line item.
  proposalLineItem.billingCap = BillingCap.CAPPED_CUMULATIVE;
  proposalLineItem.billingSource = BillingSource.THIRD_PARTY_VOLUME;
    

After these fields have been set, creating new proposal line items is done by invoking createProposalLineItems on an array of ProposalLineItem objects

Java


  // Create the proposal line item on the server.
  ProposalLineItem[] proposalLineItems = proposalLineItemService.createProposalLineItems(
      new ProposalLineItem[] {proposalLineItem});
    

Python


  # Add proposal line items.
  proposal_line_items = proposal_line_item_service.createProposalLineItems(
      [proposal_line_item])
    

PHP


    // Create the proposal line items on the server.
    $results =
        $proposalLineItemService->createProposalLineItems([$proposalLineItem]);
    

C#


  // Create the proposal line item on the server.
  ProposalLineItem[] proposalLineItems = proposalLineItemService.createProposalLineItems(
      new ProposalLineItem[] {proposalLineItem});
    

Next Steps

Enviar comentarios sobre…

DoubleClick for Publishers
DoubleClick for Publishers
¿Necesitas ayuda? Visita nuestra página de asistencia.