daroczig / fbRads

Analyze and manage Facebook ads from R using this client library to access their Marketing APIs
GNU Affero General Public License v3.0
153 stars 57 forks source link

AdSets - Issues with targetting settings #112

Closed mkmetko closed 5 years ago

mkmetko commented 5 years ago

When trying to set targeting param for new Adset, I get error:

Error in fbadrequest(fbacc, path = paste0("act", fbacc$account_id, "/adsets"), : (#100) param targeting[geo_locations][countries] must be an array.

My code: fbad_create_adset(fbacc = fb_acc_init, name = fb_adset_e_name, optimization_goal= "POST_ENGAGEMENT", campaign_id = post_campaign_id, daily_budget = 5, bid_amount = 1, targeting = list( geo_locations = list(countries = "US") ) )

This works with other calls, like fbad_reachestimate. Does fbad_create_adset need other format? Thanks

daroczig commented 5 years ago

Can you try specifying the countries as a list then to be converted into a JSON array?

geo_locations = list(countries = list("US")))
mkmetko commented 5 years ago

@daroczig already tried this, new error occurs: ERROR [2018-12-05 14:35:19] Body: {"error":{"message":"Invalid parameter","type":"OAuthException","code":100,"error_data":{"blame_field_specs":[["lifetime_budget"]]},"error_subcode":1885272,"is_transient":false,"error_user_title":"Budget Is Too Low","error_user_msg":"The budget for this ad set must be at least \u20ac3.00. Please edit your budget in your ad set to enable delivery of your ads.","fbtrace_id":"AwHt5hPegUu"}} Error in fbad_request(fbacc, path = paste0("act_", fbacc$account_id, "/adsets"), : Invalid parameter

daroczig commented 5 years ago

Awesome, then please check that error msg and act accordingly :) FTR both the previous and this error messages are coming from the FB API -- make sure to get familiar with the API endpoints and the related FB docs.