how to remove placement url's in ad group

55 views
Skip to first unread message

ken...@blvnp.com

unread,
Dec 7, 2017, 4:43:14 AM12/7/17
to AdWords API Forum
This seems not to be working


    $placement = new Placement();
    $placement->setUrl($url);

    // $adGroupCriterion = new BiddableAdGroupCriterion();
    $adGroupCriterion = new NegativeAdGroupCriterion();
    $adGroupCriterion->setAdGroupId($adGroupId);
    $adGroupCriterion->setCriterion($placement);
    // $adGroupCriterion->setBidModifier($bid_adjustment);

    $adGroupCriterionOperation = new AdGroupCriterionOperation();
    $adGroupCriterionOperation->setOperand($adGroupCriterion);

Bharani Cherukuri (AdWords API Team)

unread,
Dec 7, 2017, 2:29:42 PM12/7/17
to AdWords API Forum
Hello, 

To remove placement URL in an ad group, you could use the AdGroupCriterionService.mutate and set the AdGroupCriterionOperation as REMOVE. You may refer to the remove keywords code sample where the keyword is replaced with placement information.

Please find try out the code snippet below and let me know if you run into any issues.

const AD_GROUP_ID = 'INSERT_AD_GROUP_ID_HERE'; 
const CRITERION_ID = 'INSERT_PLACEMENT_CRITERION_ID_HERE';

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

// Create an ad group criterion.
$adGroupCriterion = new AdGroupCriterion();
$adGroupCriterion->setAdGroupId($adGroupId);
$adGroupCriterion->setCriterion($criterion);

// Create an ad group criterion operation and add it the operations list.
$operation = new AdGroupCriterionOperation();
$operation->setOperand($adGroupCriterion);
$operation->setOperator(Operator::REMOVE);
$operations = [$operation];

// Remove criterion on the server.
$result = $adGroupCriterionService->mutate($operations);

Regards,
Bharani, AdWords API Team

Ken Dan Tinio

unread,
Feb 7, 2018, 12:02:06 AM2/7/18
to AdWords API Forum
what happens if I only have url? How to remove this placement url in an adgroup level? without the criterion id..

Bharani Cherukuri (AdWords API Team)

unread,
Feb 7, 2018, 11:02:15 AM2/7/18
to AdWords API Forum
Hi Ken, 

The criterion ID is required and should not be null when it is contained within Operators : SET, REMOVE. Hence removing a Placement criteria only with placement Url is currently not possible. Let me know if you have any other questions. 
Reply all
Reply to author
Forward
0 new messages