How do you add a placement in ad group with criterion_type: MOBILE_APPLICATION?

18 views
Skip to first unread message

ken...@blvnp.com

unread,
Dec 14, 2017, 2:14:05 AM12/14/17
to AdWords API Forum
I have this code adding placements using ad group id and url


    $adGroupCriterionService = $adWordsServices->get($session, AdGroupCriterionService::class);

    $placement = new Placement();
    $placement->setUrl($url);

    if($exclude == 'true'){
      $adGroupCriterion = new NegativeAdGroupCriterion();
    }else{
      $adGroupCriterion = new BiddableAdGroupCriterion();
      $adGroupCriterion->setBidModifier($bid_adjustment);
      $adGroupCriterion->setCriterion($placement);
    } 

    $adGroupCriterion->setAdGroupId($adGroupId);

    $adGroupCriterionOperation = new AdGroupCriterionOperation();
    $adGroupCriterionOperation->setOperand($adGroupCriterion);

    switch ($operator) {
      case 'add':
        $adGroupCriterionOperation->setOperator(Operator::ADD);
      break;
      case 'set':
        $adGroupCriterionOperation->setOperator(Operator::SET);
      break;
      case 'remove':
        $adGroupCriterionOperation->setOperator(Operator::REMOVE);
      break;
      default:
        // default is add
        $adGroupCriterionOperation->setOperator(Operator::ADD);
      break;
    }


    $operations[] = $adGroupCriterionOperation;


      $results = $adGroupCriterionService->mutate($operations);

Peter Oliquino

unread,
Dec 14, 2017, 3:02:53 AM12/14/17
to AdWords API Forum
Hi Ken,

Adding a mobile application criterion as a BiddableAdGroupCriterion is similar to how you added your placement criterion. In your code, just replace the Placement object and the required fields with the ones specified in the MobileApplication documentation.

Best regards,
Peter
AdWords API Team

ken...@blvnp.com

unread,
Dec 14, 2017, 3:25:24 AM12/14/17
to AdWords API Forum
I tried this code, it seems to be not working, what did I do wrong?


        $criterion_type = new MobileApplication();
        $criterion_type->setDisplayName('Mobile App: Ken Player (Google Play), by Ken V7');

Peter Oliquino

unread,
Dec 14, 2017, 4:12:53 AM12/14/17
to AdWords API Forum
Hi Ken,

Based on the code snippet you provided, it appears that you did not specify a value for the AppId field. Could you retry and include the said field in your request and see if the issue persists? If you are still unable to add a mobile application criterion, could you provide the complete SOAP request and response so I can better identify what caused the issue?

You may refer to this guide on how to enable SOAP logging at your end and reply to me privately via the Reply privately to author option when sending the logs.
Reply all
Reply to author
Forward
0 new messages