Adwords API在广告系列级别排除Content_label [英] Adwords API Exclude Content_label on campaign level
问题描述
我一直在研究这个问题几个小时,但仍然无法找出解决方案。
我打算在广告系列一级排除一些content_labels。
首先,我遵循API示例,但这些示例是针对帐户级设置的CustomerNegativeCriteria(旁注,我无法在AdWords界面上找到这些全局设置)。
然后我阅读了更多内容,并尝试使用CampaignCriterion将它们排除在外
所以我将以这种方式创建我的ContentLabel对象: $ criterion = new ContentLabel();
$ criterion-> setContentLabelType($ sLabelType);
$ criterion-> setType(CriterionType :: CONTENT_LABEL);
然后,我会将该修饰符添加到CampaignCriterion对象:
foreach($ aModifiers as $ modifier){
$ campaignCriterion = new CampaignCriterion($ sCampaignId,$ isNegative,$ modifier,$ bidModifier);
$ operation = new CampaignCriterionOperation();
$ operation-> setOperand($ campaignCriterion);
$ operation-> setOperator($ operator);
$ operations [] = $ operation;
}
然后我会将这些操作传递给CampaignCriterionService
$ oCampaignCriterionService = $ this-> getCampaignCriterionService();
返回$ oCampaignCriterionService-> mutate($ operations);
所有这些都会产生这个错误,但我找不到如何解决这个问题。因为在活动中创建的这些值仍然是绿色的(有效的)
消息:[
CriterionError.CANNOT_TARGET_CRITERION @操作[0] .operand.criterion.contentLabelType;触发器:'DP',
CriterionError.CANNOT_TARGET_CRITERION @ operations [1] .operand.criterion.contentLabelType;触发器:'ADULTISH',
CriterionError.CANNOT_TARGET_CRITERION @ operations [2] .operand.criterion.contentLabelType;触发器:'JACKASS',
CriterionError.CANNOT_TARGET_CRITERION @ operations [3] .operand.criterion.contentLabelType;触发器:'PROFANITY',
CriterionError.CANNOT_TARGET_CRITERION @ operations [4] .operand.criterion.contentLabelType;触发器:'TRAGEDY',
CriterionError.CANNOT_TARGET_CRITERION @ operations [5] .operand.criterion.contentLabelType;触发器:'VIDEO_RATING_DV_MA'
]
任何关于我可以做什么的想法做错了?
这里的问题是我正在创建 CampaignCriterion
对象,这就是问题所在,尽管没有在任何地方明确说明,而且不直观,还有另一种类型的对象叫做 NegativeCampaignCriterion
,这是排除<$ c $的正确对象c> ContentLabel 的和展示位置
的
foreach($ aModifiers as $ modifier){
if($ isNegative){
$ campaignCriterion = new NegativeCampaig nCriterion($ sCampaignId,$ isNegative,$修饰符,$ bidModifier);
} else {
$ campaignCriterion = new CampaignCriterion($ sCampaignId,$ isNegative,$ modifier,$ bidModifier);
}
$ operation = new CampaignCriterionOperation();
$ operation-> setOperand($ campaignCriterion);
$ operation-> setOperator($ operator);
$ operations [] = $ operation;
}
I've been researching this for a few hours now and still can't figure out a solution.
I intend to exclude some content_labels on the campaign level. At first, I followed the API examples but those are for 'CustomerNegativeCriteria' that are account level settings (sidenote, I couldn't find these global settings on the AdWords interface).
Then I read more and tried to exclude them using a CampaignCriterion
So I'll create my ContentLabel objects in this way:
$criterion = new ContentLabel();
$criterion->setContentLabelType($sLabelType);
$criterion->setType(CriterionType::CONTENT_LABEL);
Then, I will add that modifier to a CampaignCriterion object:
foreach ($aModifiers as $modifier) {
$campaignCriterion = new CampaignCriterion($sCampaignId, $isNegative, $modifier, $bidModifier);
$operation = new CampaignCriterionOperation();
$operation->setOperand($campaignCriterion);
$operation->setOperator($operator);
$operations[] = $operation;
}
And then I'll pass those operations to a CampaignCriterionService
$oCampaignCriterionService = $this->getCampaignCriterionService();
return $oCampaignCriterionService->mutate($operations);
All this is generating this error but I can't find how to solve this. because in the campaign created those values are still in Green (active)
Message: [
CriterionError.CANNOT_TARGET_CRITERION @ operations[0].operand.criterion.contentLabelType; trigger:'DP',
CriterionError.CANNOT_TARGET_CRITERION @ operations[1].operand.criterion.contentLabelType; trigger:'ADULTISH',
CriterionError.CANNOT_TARGET_CRITERION @ operations[2].operand.criterion.contentLabelType; trigger:'JACKASS',
CriterionError.CANNOT_TARGET_CRITERION @ operations[3].operand.criterion.contentLabelType; trigger:'PROFANITY',
CriterionError.CANNOT_TARGET_CRITERION @ operations[4].operand.criterion.contentLabelType; trigger:'TRAGEDY',
CriterionError.CANNOT_TARGET_CRITERION @ operations[5].operand.criterion.contentLabelType; trigger:'VIDEO_RATING_DV_MA'
]
I'm following the tree structure from here but to no avail: https://developers.google.com/adwords/api/docs/reference/v201710/CampaignCriterionService.ContentLabel?hl=th
Any idea of what I could be doing wrong?
The problem here was that I was creating CampaignCriterion
objects and that was the problem, although not explicitly stated anywhere, and not intuitive, there is another type of object called NegativeCampaignCriterion
and that is the right object to exclude ContentLabel
's and Placement
's
foreach ($aModifiers as $modifier) {
if ($isNegative) {
$campaignCriterion = new NegativeCampaignCriterion($sCampaignId, $isNegative, $modifier, $bidModifier);
} else {
$campaignCriterion = new CampaignCriterion($sCampaignId, $isNegative, $modifier, $bidModifier);
}
$operation = new CampaignCriterionOperation();
$operation->setOperand($campaignCriterion);
$operation->setOperator($operator);
$operations[] = $operation;
}
这篇关于Adwords API在广告系列级别排除Content_label的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!