Facebook API Insight Metrics Daily graph API - facebook

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?

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

Related

How I get impression level log data using facebook api

I am working on facebook api. I can get total impression and clicks etc. data from facebook campaigns stats report. But my requirement is to get each impression in individual line. For example if campaign stats report shows 100 impression than I want to know 100 impression individually where they shown. Can anybody help me how I achieve this functionality of facebook marketing api.
Thanks
Hej,
You can breakdown the data by platform, device and such (check Facebook API Documentation about Breakdowns ) but as far as I am aware the API always aggregates Views that come from the same source or occurred in the same timeframe.

Facebook Graph API insights

I'm new on working with Facebook and honestly I found it very confusing, terminology and documentation seems to be very ambiguous in many cases. Can somebody please help me out with a plain english explanation on how I can achive the following?
Post and image to Facebook (on the user page) and then check the stats (insights) of that post.
Till now I have managed to:
1) Create an app
2) Post the image on the user page with the desired message
I'm not able to understand how I can retrieve information about the particular image which was uploaded through my app. I want to know how many people have viewed that image, how many likes did it get, how many times it was re-shared.
Is it possible at all?
I'm posting to /photo not too /feed and I will like to keep it this way if it is possible.
Sorry if this was answered already but I spent a few hours trying to find an appropriate answer but wasn't able to get the right documentation.
UPDATE 1
After having a couple of days off from this topic and receiving the first 2 answers, I took another dive into this. Now I have tried the Graph API Explorer as suggested, and using the ID of a POST I can get some details about the POST, but the insights aren't showing anything, just next and previous.
My goal is to be able to gatther some stats about the pictures uploaded through the app. If this is not possible directly what should be the approach I need to take?
I don't believe a personal /photo has /insights attached to it - the Insights Object documentation page suggests that they do not - but you should be able to get likes, shares, and comments via the API.
It would appear FB has launched a redesign/reorganization of its documentation in the last couple of weeks, but the documentation for the /photo graph object is here -- you will need the user's Access Token, and the API endpoints you're looking for each have links to their own documentation pages there, including example code for each type of request.
Edit (summarizing discussion in comments):
There is no method via the Facebook API to gather insights for all photos posted to individual user timelines via an app. The app can gather likes, shares, and comments for each of those objects individually via API requests, and can make API requests for insights for photos posted to its own timeline. Neither of those options solves the intended use case here.
I'd recommend a solution that uses Sharing rather than an app integration, as this allows for better access to insights on the photos being shared. This is also a much simpler integration, and less brittle wrt future Platform changes. The main tradeoff is that the original photos being shared are expected to expire after a couple of months -- if this is unavoidable, I'd suggest implementing a redirect for requests for expired objects on the site.
We are able to get different kind of photos or picture Using Graph API
like as below:
1.Page Photos
Photos for a Facebook Page.A Page Access Token is required for all methods.Find here
2.Page Picture
Picture belonging to a Facebook Page. Find here
3.Photo
Represents an individual photo on Facebook. Find here
4.User Photos
Photos for a person.Find here
I hope it's helps you.

Facebook PHP SDK limitations

I am developing a page on my site that pulls in analytics data from Facebook posts and pages, and have began with trying out the PHP SDK for Facebook.
The documentation seems to have improved in the last few months since the last time I used it, but as there is so much going on, I find it difficult to find the exact answer to my questions sometimes.
I want to get the analytics data for a number of posts and pages which are not necessarily related to each other... and also want to do this without logging in via Facebook. Is there some sort of simple API key I can use, which skips the logging in stage? I want a number of different peple to go to the site and see info from a number of different posts and pages.
Hope this makes sense.
You'll be able to get limited data from public pages and posts without logging in. Data includes number of likes, public page information, comment and likes on posts etc.
For example, if I look at the following Page https://graph.facebook.com/thetimberyard, I can see various stats like:
checkins
talking_about_count
were_here_count
likes
However, you can get better insights if you ask the user to login with read_insights permission. This permission will give you access to full insights for pages you own. Extra insights include (but not limited to):
Daily New Likes
Daily Unlikes
Daily Non/Logged-in Page Views
Weekly Non/Logged-in Page Views
Daily Internal Referrers
Daily External Referrers
Daily/Weekly/Monthly People Talking About This
Daily/Weekly/Monthly Reach Demographics, etc.

how to get past newsfeed using facebook API?

the API to fetch newsfeed is: https://graph.facebook.com/me/home?access_token=&limit=1000&untill=
which returns paginated feed output with 'next' url to fetch previous feeds.
However it stops returning newsfeed beyond a certain time. So newsfeed of few days is only available for parsing.
Is there a way out to get more historical newsfeed using facebook apis???
If you look at the graph API documentation page, /me/home is limited to only 1-2 weeks of history, and it has fallen into the "we don't care about this" category:
/me/home retrieves an outdated view of the News Feed. This is currently a known issue and we don't have any near term plans to bring them back up into parity.
Use /me/feed instead.
You can use the since and until parameters to get historical data from a user's feed. This will get you the posts that appeared between August 15-20, 2012.
/me/feed?since=2012-08-15&until=2012-08-20
The data returned by /me/feed/ is also limited. The limits aren't explicitly stated, but I never expect to be able to access more than 30 days worth of posts from one API call.

Graphing Facebook Page "Likes" Over Time

I'm having trouble finding resources for graphing the total number of likes on Facebook pages I admin.
Facebook Insights show new likes/unlikes/etc, but what I'm looking for is a way to see how many fans I have now versus, say, a month ago, and a month before that, etc etc etc, like you can with Google Analytics.
I think I'm having trouble finding resources mostly because when searching any variation of "graph facebook likes", mostly what comes up is information on the Open Graph API.
Any ideas/resources?
Try the page_fans insight, which gives you the total number of likes at any given time for your page. You should be able to go back and get data for a couple months at least.