How do I increase/decrease mobile bid criteria for adgroups for Google AdWords API?

邮差的信 提交于 2019-12-24 01:22:42

问题


So far this is what I have tried.

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

    $devices = new Platform();
    // $devices->setPlatformName('Desktop');
    $devices->setId(30000);
    // $devices->setId($app_id);
    $biddableAdGroupCriterion = new BiddableAdGroupCriterion();
    $biddableAdGroupCriterion->setAdGroupId(52012184360);
    // $biddableAdGroupCriterion->setAdGroupId($adGroupId);
    $biddableAdGroupCriterion->setCriterion($devices);
    $biddableAdGroupCriterion->setBidModifier(1.5);
    // $biddableAdGroupCriterion->setBidModifier($bid_adjustment);

    $adGroupCriterionOperation = new AdGroupCriterionOperation();
    $adGroupCriterionOperation->setOperand($biddableAdGroupCriterion);
    $adGroupCriterionOperation->setOperator(Operator::SET);
    $operations[] = $adGroupCriterionOperation;   
    $result = $adGroupCriterionService->mutate($operations);

I am having this error:

Fatal error: Uncaught Google\AdsApi\AdWords\v201710\cm\ApiException: [AdGroupCriterionError.CONCRETE_TYPE_REQUIRED @ operations[0].operand.criterion; trigger:'Criterion']


回答1:


You have to use AdGroupBidModifierService instead.

https://developers.google.com/adwords/api/docs/guides/bidding#bid_modifiers

Ad group level adjustments are accessible via AdGroupBidModifierService.

Note: This section covers bid modifiers for Platform (campaign and ad group) [...]. For all OTHER criterion types, bid modifiers [...] are maintained via AdGroupCriterionService and specified via the bidModifier attribute of BiddableAdGroupCriterion.



来源:https://stackoverflow.com/questions/50056068/how-do-i-increase-decrease-mobile-bid-criteria-for-adgroups-for-google-adwords-a

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!