Automatically setup and update your Line Items on DFP for Prebid.js
An automated DFP line item generator for Prebid.js
When setting up Prebid, your ad ops team often has to create hundreds of line items in DFP.
This tool automates setup for new header bidding partners. You define the advertiser, placements, and Prebid settings; then, it creates an order with one line item per price level, attaches creatives, and sets placement and Prebid key-value targeting.
While this tool covers typical use cases, it might not fit your needs. Check out the limitations before you dive in.
You will need credentials to access your Google Ad Manager account programmatically. This summarizes steps from Google Ad Manager docs and the DFP PHP library auth guide.
.json
private key.$ composer require googleads/googleads-php-lib
[something].json
) to googleServiceAccount.json
and move it to the project root folderadsapi_php.ini
, set the required fields:
application_name
is the name of the application you used to get your Google developer credentialsnetwork_code
is your Google Ad Manager network number; e.g., for https://www.google.com/dfp/12398712#delivery
, the network code is 12398712
.jsonKeyFilePath
is the path to your JSON key filescopes
is "https://www.googleapis.com/auth/dfp"impersonatedEmail
is the email account of the user you want to impersonate as, if any (something like user@app.iam.gserviceaccount.com)Let's try it out! From the top level directory, run
php script/tests/ConnexionTest.php
and you should whether the connexion is OK or not
Modify the settings in
/script/hb/HeaderBiddingCreation.php
Require an customer Config file, such as customerConfigSample.php. This file need to include
'priceGranularity' => [
'buckets' => [
['min' => 0, 'max' => 5, 'increment' => 0.05, 'precision' => 2 /* optional */],
['min' => 5, 'max' => 10, 'increment' => 0.1, 'precision' => 2 /* optional */],
['min' => 10, 'max' => 20, 'increment' => 0.5, 'precision' => 2 /* optional */],
]
]
Then, from the root of the repository, run:
php script/hb/HeaderBiddingCreation.php
You should be all set! Review your order, line items, and creatives to make sure they are correct. Then, approve the order in DFP.
Note: DFP might show a "Needs creatives" warning on the order for ~15 minutes after order creation. Typically, the warning is incorrect and will disappear on its own.