I want to target the mobile application,but something wrong happen via API.

80 views
Skip to first unread message

Jelly Hu

unread,
Oct 13, 2014, 7:56:52 AM10/13/14
to adwor...@googlegroups.com

Hi,

I use the CampaignCriterionService to add the criterion which targets an application .For example,to target the Clash of Clons (1-529479190).

below is the main code:
     $campaignId = 'MY_CAMPAIGN_ID';
     $campaigncriterionservice= $user->GetService('CampaignCriterionService', ADWORDS_VERSION);
     $operations = array();

     //Create campaigncriterion.
     $campaigncriterion = new CampaignCriterion();
     $campaigncriterion->campaignId = $campaignId;

     //target the app.
     $criterion = new MobileApplication();
     $criterion->appId = '1-529479190';

     $campaigncriterion->criterion = $criterion;
     $campaigncriterionoperation = new CampaignCriterionOperation();
     $campaigncriterionoperation->operand = $campaigncriterion;
     $campaigncriterionoperation->operator = 'ADD';
     $operations[] = $campaigncriterionoperation;
 
     $result = $campaigncriterionservice->mutate($operations);

It returns the error :An error has occurred: [CriterionError.CANNOT_ADD_CRITERIA_TYPE @ operations[0].operand.criterion]

But when I change the type CampaignCriterion() into NegativeCampaignCriterion() ,It blocks the App and works OK.
Please help me.

Thanks.

Jelly Hu

unread,
Oct 13, 2014, 10:01:56 PM10/13/14
to adwor...@googlegroups.com
Hi,

Sorry,I find that I need to use AdGroupCriterionService() instead of CampaignCriterionService() to target APP.It works OK.

Thank you.

Danial Klimkin

unread,
Oct 17, 2014, 7:23:53 AM10/17/14
to adwor...@googlegroups.com
Hello Jelly,


Correct. Exclusions are on the Campaign level while targeting is per AdGroup.


-Danial, AdWords API Team.
Reply all
Reply to author
Forward
0 new messages