I'm trying to get Facebook performance metrics for my marketing account.
My account had no impression prior to today. When I make a call to get performance data for today (by setting date_preset parameter to today I get response with data. But when I do a call to get yesterday's data (when I had no impressions), I get empty response:
{'data': []}
This is not very helpful. I'd like to get response with impressions = 0. How can I do that?
I do the call to the following url:
https://graph.facebook.com/v2.9/ACCOUNT_ID/insights?level=ad&fields=impressions&&date_preset=yesterday&access_token=MY_ACCESS_TOKEN
Unfortunately, that is not possible, as Facebook only returns data if there is data to return. What you can do is provide a callback to the response that checks if data exists for a certain day, and if not, populate that day with zeros.