通过API在Group Criterion中设置新展示位置

时间:2015-12-02 13:49:18

标签: google-adwords

如何使用AdWords API在广告组中添加新展示位置(例如www.example.com)?

我找到了

    AdGroupCriterionService->mutate, 

但我需要知道网站ID

    $adGroupCriterion->criterion = new Criterion($criterionId);

所以我的问题:

我如何找到任何网站的ID或以其他方式在广告组中添加新的展示位置?

1 个答案:

答案 0 :(得分:0)

我找到了答案:

$adGroupService = $user->GetService('AdGroupCriterionService', 'v201509');

$AdGroupCriterionOperation = new AdGroupCriterionOperation();
$AdGroupCriterionOperation->operator = 'ADD';

$AdGroupCriterion = new BiddableAdGroupCriterion();
$AdGroupCriterion->adGroupId = $adGroupId;
$AdGroupCriterion->criterionUse = 'BIDDABLE';
$AdGroupCriterion->AdGroupCriterionType = 'PLACEMENT';

$Placement = new Placement();
$Placement->id = null;
$Placement->CriterionType = 'PLACEMENT';
$Placement->type = 'PLACEMENT';
$Placement->url = $url;

$AdGroupCriterion->criterion = $Placement;
$AdGroupCriterionOperation->operand = $AdGroupCriterion;

$operations = array($AdGroupCriterionOperation);
// Make the mutate request.
$result = $adGroupService->mutate($operations);