Prebid Line Item Manager

Introduction

The Prebid Line Item Manager is a command line tool built in Python to aid in creation of line items for Prebid header bidding integrations. The goal of this tool is to allow publishers to save time, and prevent issues when creating the required Prebid line-item set up manually.

Installation

Note: This tool requires Python 3 to be installed on your machine, and support is for Python>=3.6.

From your command line run:

$ pip install line-item-manager

If you already have it installed you can upgrade it using

$ pip install --upgrade line-item-manager

Usage

Configuration file

This tool uses a base (default) configuration as a starting point to create line items. You can create your own version of this and modify the parameters in it to suit your line item requirement. To see what the config file contains, run the command below:

$ line_item_manager show config

You can look at the full config here. To save time and build on the default config, create a new config file of your own using the following command:

$ line_item_manager show config > my_config.yml

Once you have your own file you can follow the comments in the file itself to manage the line item creation settings. You can do things like creative, line item, order setups, as well as options like granularity and targeting, etc. can all be input there. Please ensure you are using YAML syntax to make your updates.

Examples (the # indicates comments in the YAML syntax)

Creative setup

creative: # at least one of the following types is required {video, banner}
    banner:
        # safe_frame: False # optional: defaults to True
        # size_override: False # optional: defaults to True with a 1x1 creative
        sizes: # list
            - height: 250
            width: 300
        snippet:
            <script src = "https://..."></script>
            <script>
                ...
            </script>
    video:
        sizes: # list
            - height: 480
            width: 640
        vast_xml_url: "https://prebid.adnxs.com/pbc/v1/cache?uuid=%%PATTERN:%%"

Order setup

order:
    name: "Prebid--- -"

Line Item setup

line_item:
    name: "Prebid--- @ "
    item_type: "price_priority"
    # Optional
    # priority: 12 # default is 12
    # start_datetime: "11/17/20 21:28"
    # end_datetime: "12/17/20 21:28"
    # timezone: "UTC"

Custom Granularity setup

rate: 
    currency: "USD" # required
    granularity:
        type: "custom" # required, choices: "low", "med", "high", "auto", "dense", "custom"
        custom: # optional, requires type "custom" above
            - min: 0.10
              max: 30.00
              interval: 0.10
            - min: 30.50
              max: 50.00
              interval: 0.50
    # optional properties
    # vcpm: 100000 # viewable impressions will be enabled

Note: The GAM Network ID, can also be input at runtime and will override the default Network ID in the config file.

Line Item creation

When you are ready with the config file you can now use the create command to run the tool to create line items.

Note: You will require at least one modifier (choosing bidder specific set of orders or single set of orders for all bidders)

$ line_item_manager create my_config.yml --[bidder-code|--single-order]

Examples:

$ line_item_manager create my_config.yml -b rubicon

This would create a set of orders for bidder Rubicon

Line Item Results 1

$ line_item_manager create my_config.yml -b rubicon -b appnexus -b openx

This would create a set of orders for bidders Rubicon, Appnexus and OpenX

Line Item Results 2

$ line_item_manager create my_config.yml --single-order

This would create a single set of orders with bidder agnostic key value targeting

Line Item Results 3

Modifiers for create

The create function has certain modifiers that can be used to do dry runs and test runs for line item creation. Here are all the modifiers that can be used:

Modifier Type Description
–network-code INTEGER GAM network code, must reconcile with the network name.
–network-name TEXT GAM network name, must reconcile with the network code.
-k, –private-key-file PATH Path to json GAM credentials file. [default: gam_creds.json; required]
-s, –single-order   Create a single set of orders instead of orders per bidder. [default: False]
-b, –bidder-code TEXT Bidder code may be used multiple times.
-t, –test-run   Execute a limited number of line_items for testing and manual review. Please ensure that you archive the orders so as not to clash with the actual production orders and line items you wish to create. [default: False]
-n, –dry-run   Print commands that would be executed, but do not execute them. [default: False]
-q, –quiet   Logging is limited to warnings and errors. [default: False]
-v, –verbose   Verbose logging; use multiple times to increase verbosity. [default: False]
–skip-auto-archive   Upon failure or interruption, do NOT auto-archive already created orders. [default:False]

Commands for line_item_manager

Modifier Description
create Create line items
show Show resources. Options: “config” or “bidders”

All commands can use the --help modifier to see various options for the command

Troubleshooting (Coming soon!)

Git Repository

https://github.com/prebid/line-item-manager

Contributing code? Found a bug? If you wish to push changes, please create a Pull Request so we can review the change and approve.

Also, if you have a question or want to notify us about something, please create a github issue.