facebookfacebook-graph-apimetricsfacebook-insights

Facebook API Insight Metrics Daily graph API


Hi Guys I am hoping someone could help me.

I have been toying around with the Facebook API for our company's facebook analytics page. I am looking to get information on the likes, shares, impressions etc and store directly to a database

I have been able to pull this information back using the Graph API Explorer. Now I want to be able to pull the information back for say today. When I add today's date in it only relates to the actual posts that were posted today, not today's activity. if that makes sense.

An example of this is if I had liked a post today that was created 2 days ago, it doesnt show in in today's activity, but the activity from 2 days ago.

The code I have been using is: feed?fields=comments.limit(1).summary(true),likes.limit(1).summary(true)&since=2016-10-28

Just wondering if I am missing something as surely should be an easy way of getting todays actual activity from users?


Solution

  • Your example isn't fetching Insights, you're fetching the posts visible on the page's Timeline, then asking for a count of the comments and likes

    There's a totally different API for fetching Insights data: https://developers.facebook.com/docs/platforminsights/page

    This is the same API used by the Insights UI, so for the same set of metrics/dates, it should give identical results to the UI