如何降低Google AdWords API广告系列的移动设备出价标准?

时间:2015-07-28 00:47:16

标签: php google-adwords

当我将平台出价条件设置为0时,它会给我一个错误:

  

例外' SoapFault'消息' [OperatorError.OPERATOR_NOT_SUPPORTED @ operations [2] .operand.criterion;触发:' CriterionId {ID = 30001}']'

// Mobile criterion ID.
$mobileCriterionId = 30001;
$platform = new Platform();
$platform->id = $mobileCriterionId;

$operations = array();
foreach ([$location, $language, $platform] as $criterion) {
  // create criteria
  $campaignCriterion = new CampaignCriterion();
  $campaignCriterion->campaignId = $campaign->id;
  $campaignCriterion->criterion = $criterion;

  if ($criterion == $platform) 
    $campaignCriterion->bidModifier = 0;

  // create operations to perform
  $operation = new CampaignCriterionOperation();
  $operation->operand = $campaignCriterion;
  $operation->operator = 'ADD';
  $operations[] = $operation;
}

// carry out the operations
$result = $campaignCriterionService->mutate($operations);    

平台:https://developers.google.com/adwords/api/docs/appendix/platforms

标准用法矩阵:https://developers.google.com/adwords/api/docs/guides/criteria-usage

示例(适用于广告组):https://developers.google.com/adwords/api/docs/guides/adgroup-bid-modifiers#update

CampaignCriterion:https://developers.google.com/adwords/api/docs/reference/v201502/CampaignCriterionService.CampaignCriterion

版本:v201502,测试帐号

1 个答案:

答案 0 :(得分:4)

我不得不使用' SET'而不是添加'操作,但仅限于平台。很明显,嗯?

  if ($criterion == $platform)
    $operation->operator = 'SET'; # all platforms automatically added to new campaigns. cannot re-ad. must set.