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

Cannot extract converted_product_value #140

Closed Datacove1 closed 3 years ago

Datacove1 commented 3 years ago

Hello,

I'm using the API to build some simple campaign reports for one of my clients and one of the fields they are interested in is Purchase value - but no matter what I do, I can't seem to pull it, eventhough I can pull purchases. I've looked at the API documentation and saw this - but I have no idea what a "converted product ID breakdown" is:

image

The code that I'm using to pull the data is below - as I said, everything else is coming through, but the Purchase value!

FB_raw <- fb_insights(level="ad",time_increment=1,date_preset="this_year",breakdowns="publisher_platform", action_attribution_windows="28d_click,7d_view", fields=toJSON(c("campaign_name","adset_name","ad_name","spend","impressions", "inline_link_clicks","actions","converted_product_value"))) %>% do.call(rbind.data.frame,.)

Any help much appreciated!

daroczig commented 3 years ago

I suspect you need to provide the required param in the breakdowns parameter instead of or besides the publisher_platform - see the related docs at https://developers.facebook.com/docs/marketing-api/insights/breakdowns

As the ticket is not related to the R package, I'm closing, but let me know if you run into any issues with the R implementation.

Datacove1 commented 3 years ago

Thank you! Was beginning to drive myself mad, but from looking at that page, it seems as if the breakdowns cannot be combined (publisher platform and action_converted_product_id), so I'm going to have to record the data manually. Appreciate the help!