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

DFP Sales Manager Product Packages

This guide explains the connection between the product package tab in DFP Sales Manager and the ProductPackage, Package, and ProductPackageItem services in the API. It walks you through using your sales catalog via the API and ties together the facets of end-to-end trafficking.

Primer

The “Product Package” tab in DFP Sales Manager represents groupings of your product objects that you want to sell together. As an example, you might have a product package selling specifically to a ‘sports enthusiast’ crowd that has various products targeting specific keys or audience segments. Among these, you might have some products that are optional and some which are mandatory.

ProductPackage objects, when associated with a proposal and populated with ProductPackageItems will form Packages. Packages are in effect a “shopping cart” with items that need to go through the “checkout” process before they become ProposalLineItems.

Product packages and the sales manager catalog

Creating product packages

The “Product Package” tab in the UI is a composite of three objects: ProductPackages, ProductPackageItems, and Packages. To use all three effectively, the first step is to create a ProductPackage. This is equivalent to instantiating an empty product package in the UI Panel:

image

Everything starts with instantiating the right service for the job:

Java

    ProductPackageServiceInterface productPackageService =
        dfpServices.get(session, ProductPackageServiceInterface.class);

Python

  product_package_service = client.GetService('ProductPackageService',
                                              version='v201702')

Create a local ProductPackage object and set the name as well as an array of any RateCard IDs you want to price your ProductPackageItems with later on:

Java

    // Create a local product package.
    ProductPackage productPackage = new ProductPackage();
    productPackage.setName(
        "Product package #" + new Random().nextInt(Integer.MAX_VALUE));
    productPackage.setRateCardIds(new long[] {rateCardId});

Python

  # Create a local product package.
  product_package = {
      'name': 'Product Package #%d' % random.randint(0, 100000000),
      'rateCardIds': [RATE_CARD_ID]
  }

Once you’ve set these three fields, you can persist the ProductPackage objects on DFP’s server:

Java

    // Create the product package on the server.
    ProductPackage[] productPackages =
        productPackageService.createProductPackages(
            new ProductPackage[] {productPackage});

Python

  result = product_package_service.createProductPackages([product_package])

This new product package is actually only a component of what you see in the UI, as the product package in DFP has multiple parts. The created product package is equivalent to the top portion product package panel in the UI:

image

Creating product package items

In creating ProductPackageItems, you are effectively grouping, and assigning rate card restrictions to, products you wish to sell together in a product package. These objects are halfway between products and proposal line items. This is equivalent to adding products to an empty product package as created above:

image

Start with fetching the appropriate service and creating an empty constructor for the ProductPackageItem object:

Java

    ProductPackageItemServiceInterface productPackageItemService =
        dfpServices.get(session, ProductPackageItemServiceInterface.class);
    
    // Create a local product package item.
    ProductPackageItem productPackageItem = new ProductPackageItem();

Python

  product_package_item_service = client.GetService('ProductPackageItemService',
                                                   version='v201702')

From there, the fields that you are required to set are the product from which you want to create the ProductPackageItem and the product package ID under which to group the ProductPackageItems. You can also specify if they must use this product package item when selling the product package.

Java

    // Set the product from which the product package item is created.
    productPackageItem.setProductId(productId);
    
    // Set the product package that the product package item belongs to.
    productPackageItem.setProductPackageId(productPackageId);
    
    // Specify if the product package item is required for this product package.
    productPackageItem.setIsMandatory(true);

Python

  product_package_item = {
      # Set the product from which the product package item is created.
      'productId': PRODUCT_ID,
      # Set the product package that the product package item belongs to.
      'productPackageId': PRODUCT_PACKAGE_ID,
      # Specify if the product package item is required for this
      # product package.
      'isMandatory': True
  }

After you’ve set the required fields, you can persist the objects on the DFP server.

Java

    // Create the product package item on the server.
    ProductPackageItem[] productPackageItems =
        productPackageItemService.createProductPackageItems(
            new ProductPackageItem[] {productPackageItem});

Python

  # Create the product package item on the server.
  result = product_package_item_service.createProductPackageItems(
      [product_package_item])

Once you’ve created these under your product package, they will appear in the UI as the list at the bottom of the product package panel:

image

Using product packages in a proposal

Creating a package

After creating a product package and associating product package items underneath it, you need to create a virtual ‘shopping cart’ that bridges between a product package and your proposal. This lets you fill in the specific sales values that aren’t represented by unsold products. This is represented by the Package object, and equivalently the shopping cart that’s generated from the proposal creation screen:

image

Start by instantiating a PackageService:

Java

    PackageServiceInterface packageService =
        dfpServices.get(session, PackageServiceInterface.class);

Python

  package_service = client.GetService('PackageService', version='v201702')

Then create a local Package object and set the required fields of Name, ProposalId, ProductPackageId, and the RateCardId that you want to associate with your ProposalLineItems.

Java

    // Create a local package.
    Package pkg = new Package();
    pkg.setName("Package #" + new Random().nextInt(Integer.MAX_VALUE));
    
    // Set the proposal ID for the package.
    pkg.setProposalId(proposalId);
    
    // Set the product package ID to create the package from.
    pkg.setProductPackageId(productPackageId);
    
    // Set the rate card ID the proposal line items are priced with.
    pkg.setRateCardId(rateCardId);

Python

  # Create local package.
  package = {
      'name': 'Package #%d' % random.randint(0, 1000000),
      'proposalId': PROPOSAL_ID,
      'productPackageId': PRODUCT_PACKAGE_ID,
      'rateCardId': RATE_CARD_ID,
  }

With those fields set, you can now create a Package on the DFP server.

Java

    // Create the package on the server.
    Package[] packages = packageService.createPackages(new Package[] { pkg });

Python

  # Create the package on the server.
  result = package_service.createPackages([package])

Creating proposal line items from packages

Once you have a package, the last step before you can continue selling your proposal is to create proposal line items from the package. Up through this point, the product package items have not yet been added to the proposal. This requires an action to be performed with a statement filtering your packages:

Java

    // Create a statement to select a single package.
    StatementBuilder statementBuilder = new StatementBuilder()
        .where("id = :id")
        .orderBy("id ASC")
        .limit(1)
        .withBindVariableValue("id", packageId);
    
    // Get the package.
    PackagePage page = packageService.getPackagesByStatement(statementBuilder.toStatement());

    Package pkg = Iterables.getOnlyElement(Arrays.asList(page.getResults()));
        // Create action to activate packages.
    com.google.api.ads.dfp.axis.v201702.CreateProposalLineItemsFromPackages action = 
        new com.google.api.ads.dfp.axis.v201702.CreateProposalLineItemsFromPackages();
    
    // Perform action.
    UpdateResult result = packageService.performPackageAction(
        action, statementBuilder.toStatement());

Python

  # Create a statement to select the single package.
  statement = (dfp.StatementBuilder()
               .Where('id = :id')
               .OrderBy('id', ascending=True)
               .Limit(1)
               .WithBindVariable('id', PACKAGE_ID))

  # Get the package.
  query_result = package_service.getPackagesByStatement(statement.ToStatement())

  package = query_result['results'][0]

  # Perform update packages action.
  result = package_service.performPackageAction(
      {'xsi_type': 'CreateProposalLineItemsFromPackages'},
      statement.ToStatement())

At this point, you will have a proposal that contains the proposal line items sold from the product package. The package you just used to create proposal line items from will have a Status of COMPLETED. You can continue the submission process through the proposal workflow.

Next steps

  • Submitting proposals and working with worklows

Send feedback about...

DoubleClick for Publishers
DoubleClick for Publishers
Need help? Visit our support page.