Following the doc here
https://developers.facebook.com/docs/marketing-api/reference/ad-campaign-group/insights/
I'm querying insights on ad performance etc. However, I can't make the time_frame work. A query like this
just returns lifetime stats. I've tried to modify the query in many ways, but it's always an error or lifetime.
Any help would be highly appreciated!
Thanks
I imagine you've found the answer by now but this could help someone else as from experience the documentation isn't always the most friendly to jump into.
You'll need to format it as a time_range object, the example object below is from that page of the documentation you included. It's essentially just an object with 2 properties- since and until.
{'since'=>YYYY-MM-DD,'until'=>YYYY-MM-DD}
So from the example URL you're using, rather than setting the since and until values using individual parameters, the time range would be set like this (I've URL encoded the object):
time_range=%7B%22since%22%3A%22YYYY-MM-DD%22%2C%22until%22%3A%22YYYY-MM-DD%22%7D