Create LineItem with predefined Key and Dynamic Value

107 views
Skip to first unread message

thomas...@adtechfactory.com

unread,
Dec 27, 2018, 11:34:14 AM12/27/18
to Google Ad Manager API Forum
Hello,

I am using the Admanager API (PHP LIB) to create a bulk of Line Items. For each of these Line Items I need a predined Key and a dynamic value (not defined)  like

  • price_bucket=0.01
  • price_bucket=0.02
  • price_bucket=0.03
  • .....

Currently I have one predefined Key/Value for testing and it works fine for me

        $priceBucket = new CustomCriteria();
        $priceBucket->setKeyId(intval(11788012));
        $priceBucket->setOperator(CustomCriteriaComparisonOperator::IS);
        $priceBucket->setValueIds([448054558032]);

Can anyone tell me how I can set a Targeting for a key/value if the value is not predefined and therefore I do not have an ID ? I need something like

 $priceBucket = new CustomCriteria();
        $priceBucket->setKeyId(intval(11788012));
        $priceBucket->setOperator(CustomCriteriaComparisonOperator::IS);
        $priceBucket->setValue("pb_0.01");

Thanks for your support

Best

Vincent Racaza (DFP API Team)

unread,
Jan 3, 2019, 9:02:53 PM1/3/19
to Google Ad Manager API Forum
Hi,

Dynamic values are not supported as custom targeting values. You will really need to add these values first under a key, therefore, it will always have a custom targeting value ID. The valueIds field is also required when targeting key-values on a line item.

If you want to make a filter using key-values through the API, you can use the Custom Targeting Service which provides operations for creating, updating and retrieving CustomTargetingKey and CustomTargetingValue objects. You can then only filter out by the PQL properties available through getCustomTargetingKeysByStatement and getCustomTargetingValuesByStatement methods you choose.

Thanks,
Vincent Racaza, Ad Manager API Team
Reply all
Reply to author
Forward
0 new messages