example-dfp-line-item-generator
example-dfp-line-item-generator copied to clipboard
`argv.offset` undefined
Hi all,
I was able to set up my order correctly, but when I tried setting up my line items I couldn't get any value for argv.offset. If you notice, this is the undefined part of the order name. Also, how are you able to associate the line items with the order? I'm working off the granular-prebid branch

For prebid, I had to generate more line items that would fit into a single order, so my strategy was to create line items in 5 cent increments within an order and have each order start at a different amount.
PREBID_A_INT_1-CENT= 0.01, 0.06, 0.11, 0.16, etcPREBID_A_INT_2-CENT= 0.02, 0.07, 0.12, 0.17, etc
offset is another command line argument that would be 1 or 2. A good follow up would be to add that to the doc string at the top of the file, if you want to make a PR!
As for your question about how to associate a line item with an order, DFP needs you to pass the order's id when you send a create line item request. Generally, you don't know the order's id, so instead node-google-dfp-wrapper does a lookup based on the order name you pass it and replaces orderName with the orderId it finds. If you're interested, that happens here.
Thank you. Both of those problems are fixed now but I am still getting this message
[Error: Expected to find results, but there were none]
creating line items failed
because Error: Expected to find results, but there were none
I'm thinking this is an error in which I am not parsing the correct data correctly into their respective DFP fields
createLineItem does a few other lookups, one for adUnitId, and (for each custom criteria pair you pass in) one for the key and one for the value. The error means one of those queries is returning no results.
Sorry the error handling isn't better. I have an idea for how to improve it with currying/partially applied functions.
No worries! That pointed me in the right direction. In channel-criteria.json was able to locate the keyId of the key I wanted to select in DFP but had trouble finding valueIds. Any idea where I could find Value IDs in DFP? Or is that specific to Curiosity?
channel-criteria.json is just a lot of ids that we used over and over again, so I wrote that file for easy access. Look through this method and other methods it calls. They'll give you the ability to query DFP to find the id of any key, then they id of any value within that key. The only tricky thing could be that they use a caching mechanism, so if your keys change you'll have to clear the cache.
hey Juan,
Looks I'm encountering an SQL parsing issue, but I'm not sure how to parse the value I'm passing from my function so that it may fit within the query. My prepareQuery function looks like this:
function prepareQuery() {
var allLineItems = [
platform + size + position,
partner].join('_');
console.log(allLineItems);
return allLineItems;
}
I've tried it with and without the wildcard.
My creative looks like this: D728X90leaderboard_YIELDBOT and my command line script looks like this: node create-associations.js --channel A --platform D --position leaderboard --region USA --partner YIELDBOT
This is the error I'm getting:
Error: soap:Server: [PublisherQueryLanguageSyntaxError.UNPARSABLE @ Unable to parse query: 'Where '
I think this is a bug. Try returning { name: allLineItems } from prepareQuery and see if that works. I think I missed this after pushing some breaking changes to node-google-dfp-wrapper. The best reference for that module's API are the tests I wrote https://github.com/spanishdict/node-google-dfp-wrapper/blob/master/tests/line-item-test.js#L41