I've been fighting with the Facebook Marketing API in the last days. I simply want to retrieve the cost_per_action_type but matched with the campaign's objective.
I've discovered this: https://developers.facebook.com/docs/marketing-api/reference/ads-action-stats/.
But I simply cannot retrieve that data! I didn't find any working examples or at least guides on the web. I pasted some links below but they aren't of any help. Maybe this is how connected to the insights API, but I don't know how.
Do you have any idea?
Related: Match facebook campaign objective with insights actions types https://github.com/facebook/facebook-php-ads-sdk/issues/278
-
hey. did you solve this?Adam– Adam2020年09月28日 05:08:10 +00:00Commented Sep 28, 2020 at 5:08
-
Hey @Adam, no, I didn't.Paul Razvan Berg– Paul Razvan Berg2020年09月28日 09:00:54 +00:00Commented Sep 28, 2020 at 9:00
-
ohh. I am actually calling act_<AccountId>/insights endpoint successfully but i could only get a few of the AdActionsStats types. For example purchase_roas comes back with values but converted_product_quantity it doesn't. so weirdAdam– Adam2020年09月29日 04:18:20 +00:00Commented Sep 29, 2020 at 4:18
2 Answers 2
The way to get the cost per action type is with this endpoint:
<campaign ID>/insights?fields=cost_per_action_type
You can substitute Campaign ID with Adset ID if you prefer.
Comments
I faced the same problem like you, I use almost one day to figure it out. The point is you cannot reach the Ads Action Stats, the reason why is that the just mean status of the ads-insight; therefore,you would just see
website_ctr [{'action_type': 'link_click', 'value': '0.714286'}]
cost_per_action_type [{'action_type': 'link_click', 'value': '30'}, {'action_type': 'landing_page_view', 'value': '30'}, {'action_type': 'post_engagement', 'value': '30'}, {'action_type': 'page_engagement', 'value': '30'}, {'action_type': 'omni_view_content', 'value': '15'}]
cpc 7.5
cpm 214.285714
spend 60
date_start 2019年06月03日
date_stop 2019年07月03日
age 35-44
you can find that [{'action_type': 'link_click', 'value': '30'}, {'action_type': 'landing_page_view', 'value': '30'}, {'action_type': 'post_engagement', 'value': '30'}, {'action_type': 'page_engagement', 'value': '30'}, {'action_type': 'omni_view_content', 'value': '15'}] is the Ads Action Stats you want.
Comments
Explore related questions
See similar questions with these tags.