How to remove placements from a campaign?

127 views
Skip to first unread message

Anna Nguyen

unread,
Oct 7, 2014, 3:03:44 PM10/7/14
to adwor...@googlegroups.com
Hello,

I've been wrestling with this for a couple of weeks now and I can really use some clues.

I am using API version v201406.  I need to be able to:
1. identify placements (e.g. "about.com") in a running campaign that has more than N impressions and,
2. CPC of more than $X and then exclude those placements from the campaign.

For 1., I am using ReportService to get the campaign's PLACEMENT_PERFORMANCE_REPORT, which lists its placements along with impressions, CPC etc. from which I can select the  placements to be excluded.  (The criterionID returned is always "--".)

To remove those placements from the campaigns, I think I need to use MutateJobService.mutate, which takes a list of CampaignCriterionOperations, each with an Operator ("ADD", "REMOVE", or "SET") and a CampaignCriterion.  The CampaignCriterion has a Placement, which has an ID and an URL, and this is my problem.  I need to get the placement's criterion ID.  I tried using CampaignCriterionService.get on the campaign, passing it (in Ruby):

    selector = {
      :fields => ['CampaignId', 'Id', 'CriteriaType', 'PlacementUrl', ],
      :predicates => [
        { 
          :field => 'CampaignId',
          :operator => 'EQUALS',
          :values => [ campaign_id ]
        },
        {
          :field => 'CriteriaType',
          :operator => 'IN',
          :values => [ 'PLACEMENT' ]
        },
      ],
      :paging => {
        :start_index => 0,
        :number_results => AdwordsCommon::PAGE_SIZE
      }
    }

BUT.  CampaignCriterionService.get returns a set of placement URLs that is 100% disjoint with the placement URLs that I got from the performance report:  the two sets of URLs have nothing in common!  What am I doing wrong an what do I actually need to do?  Thanks!

Josh Radcliff (AdWords API Team)

unread,
Oct 8, 2014, 9:06:33 AM10/8/14
to adwor...@googlegroups.com
Hi,

Regarding adding the placements, you do not need to specify an id when performing the ADD operation - AdWords will assign the ID as part of the operation. The id is only required when performing a SET or a REMOVE. In other words, to exclude a placement at the Campaign level, you'd create a NegativeCampaignCriterion with:
  • campaignId = your campaign ID
  • criterion = Placement with:
    • url = the URL to exclude
Note that you can also exclude placements at the AdGroup level -- just ADDNegativeAdGroupCriterion instead of a NegativeCampaignCriterion.

Cheers,
Josh, AdWords API Team

Anna Nguyen

unread,
Oct 16, 2014, 2:50:38 PM10/16/14
to adwor...@googlegroups.com
That worked!  Thanks!

--
Anna
Reply all
Reply to author
Forward
0 new messages