0

I wanted to fetch the daily ad spends in Facebook based on campaigns separately, ie, for each campaign with its spend. I have tried with API call, but that gives state wise classification. How do I group based on campaign names?

"https://graph.facebook.com/v14.0/act_xxxxxx/insights?" + encodeURI("level=ad&fields=spend&access_token=FB_ACCESS_TOKEN&breakdowns=region,country&time_range={'since':'2022-08-09','until':'2022-08-09'}&filtering=[{\"field\":\"country\",\"operator\":\"CONTAIN\",\"value\":\"US\"}]&limit=100")
Code Guy
  • 3,059
  • 2
  • 30
  • 74

1 Answers1

0

Campaigns and adsets has an insights field where you can read performance and spending metrics.

Get insights from campaigns endpoint

https://graph.facebook.com/v14.0/act_xxx/campaigns?fields=name,insights{spend}

you can use date filters with you calls to get lifetime spending.

you can also get spending from campaign adset insights field.

Check the official documentation https://developers.facebook.com/docs/marketing-api/reference/ad-campaign/insights

sh.e.salh
  • 508
  • 2
  • 5
  • 16