Add mobile application criterion for campaign

40 views
Skip to first unread message

anir...@deltax.com

unread,
Jul 27, 2015, 4:29:51 AM7/27/15
to AdWords API Forum
I'm trying to add a mobile application criterion at campaign level

            CampaignCriterion mobileApp = new CampaignCriterion();
            mobileApp.campaignId = objCampaign.SearchEngineCampaignId.Value;
            mobileApp.criterion = new MobileApplication(){appId = "2-com.whatsapp", };
           
            CampaignCriterionOperation campaignCriterionOperation1 = new CampaignCriterionOperation();
            campaignCriterionOperation1.@operator = Operator.SET;
            campaignCriterionOperation1.operand = mobileApp;
            campaignCriterionOperations.Add(campaignCriterionOperation1);

I get an ID required error. Anything im doing wrong?

Umesh Dengale

unread,
Jul 27, 2015, 4:52:35 PM7/27/15
to AdWords API Forum, anir...@deltax.com, anir...@deltax.com
Hello,

The appId - consists of{platform}-{platform_native_id} where platform is "1" for iOS apps and "2" for Android. For Android, the native identifier is the application's package name (e.g., "com.labpixies.colordrips" for "Color Drips" given Google Play link https://play.google.com/store/apps/details?id=com.labpixies.colordrips). A well-formed app id for AdWords API would thus be "2-com.labpixies.colordrips" for Android. Could you check platform_native_id value in the above code?

Thanks,
Umesh, AdWords API Team.

anir...@deltax.com

unread,
Jul 27, 2015, 11:15:24 PM7/27/15
to AdWords API Forum, adwordsapia...@google.com
Hi,

The native app Id for whatsapp is com.whatsapp . I picked this up from the adwords interface after a lookup. Plus the error says I require an Id. Referring to criterion object's Id.

Umesh Dengale

unread,
Jul 29, 2015, 10:46:59 AM7/29/15
to AdWords API Forum, anir...@deltax.com, anir...@deltax.com
Hello,

For MobileApplication object, the id field shouldn't be required on ADD operations and use ADD operator instead of SET.  The Id field is required on SET and REMOVE to identify the specific existing criterion you want to alter.
You could use AdGroupCriterionService() instead of CampaignCriterionService() as targeting is per AdGroup and exclusions are on the campaign level. Please refer this previous post.
Reply all
Reply to author
Forward
0 new messages