Hi Hassan,
Thank you for reaching out to us.
After investigating, it seems that the error occurs on the following line:
$targeting->setCustomTargeting($permutive);
Specifically, the setCustomTargeting takes a CustomCriteriaSet, but the $permutive object is of type CustomCriteria instead. You may check our example code, specifically lines 148-181, for further details on how to correctly use setCustomTargeting.
Regards,
Ziv Yves Sanchez, Ad Manager API Team
Thanks for the reply.
Provided examples shows combination of multiple criteria sets (keys). I am still unable to find how to target only one and key and value?
Hi Hassan,
Going back to the example code provided in my previous response: you only really need lines 155-158 for the primary CustomCriteriaSet, lines 143-146 to define the CustomCriteria that you wish to target, and finally lines 176-178 to insert this CustomCriteria as a child for the CustomCriteriaSet. The expectation here is that line 177 should only contain one child (which will be the CustomCriteria above).
Hi Hassan,
I was able to test the same sample code successfully on my end. Could you kindly provide the details below (via Reply privately to author) so that I can further investigate the issue?
Hi Hassan,
Kindly check my answers to your questions below: