Exclude Content_label on campaign level

13 views
Skip to first unread message

a.ro...@cyberpuerta.mx

unread,
Dec 13, 2017, 4:29:00 AM12/13/17
to AdWords API Forum
Hi, 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:


Any idea of what I could be doing wrong?

a.ro...@cyberpuerta.mx

unread,
Dec 13, 2017, 2:29:24 PM12/13/17
to AdWords API Forum

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 {
Reply all
Reply to author
Forward
0 new messages