How to request all insights for a page Facebook API - facebook

I am developing an application which will need to access multiple page insight metrics for a Facebook page. However, rather than running multiple queries for the metrics that I would like, I was wondering if I could just request all of a page's insights. I thought that to get that, I could just use:
{page-id}/insights
However this query returns a "FacebookAuthenticationException." When I run this query on the Graph API Explorer, I get the user message "No metric specified."
So is there anyway to retrieve all of a page's insights?

I thought that to get that, I could just use: {page-id}/insights
No, that is not possible any more.
https://developers.facebook.com/docs/apps/changelog#v2_7_changes:
Page Insights Change Page metrics insights must now be explicitly specified when making Page Insights related requests. The default behavior of returning all metrics when none are specified is no longer supported.
So you will have to pick the metrics you are interested in, and request those specifically:
{page-id}/insights/metric_name1,metric_name2,...

Related

Facebook graph API Insights requests limit

I have an app which manages hundreds of Facebook pages. Now I need to make a dashboard which will show reports based on Facebook insights for every page but when I try to get the data from Facebook I am getting a message saying that I am reaching the requests limit and I am not able to make requests to Facebook Insights any more.
For every page I get 10-15 metrics in a single request, but I have hundreds of pages.
I found that the limit is 200 App request per hour, but for insights there are different rules.
How I can make my dashboard works because even batch requests did not help?
Request that your app be upgraded to Standard Access. An overview of the access tiers and instructions for requesting an upgrade are here: https://developers.facebook.com/docs/marketing-api/access

Get Facebook Page Offers that haven't Expired via Graph API

I have a Facebook Page. I am trying to get the Non Expired 'Offers' that exist from the Pages that my Page Likes.
This is what I use to get all the offers (Including Expired):
GRAPH GET (2.5): /210111832375724/likes?fields=offers
(210111832375724 is my page ID)
I have used 'since(now)', but it failed. It seems to work for events, but not offers.
I could just get all offers and then use my software to select ones that haven't expired, but thought I would see if there is a better solution.
Following the Facebook docs, I don't see another possibility then to filter the "valid" ones from the Graph API call's response. There is currently no general way to filter results in the Graph API.
See
https://developers.facebook.com/docs/graph-api/reference/page/offers/#Reading
https://developers.facebook.com/docs/graph-api/reference/v2.5/offer

Open Graph insights for specific post

We have a Facebook Application with custom Open Graph objects and actions.
We then use a App Access Token to post stories for a particular user from our backend with the normal Open Graph REST API. After the post-call succeeds we log the returned "id" of that post.
Now we would like to collect insight data (e.g. post_impressions_unique) for some of these individual posts/stories using the logged id's.
According to https://developers.facebook.com/blog/post/573/ we should be able to do something like:
https://graph.facebook.com/[POST ID]/insights
Even though this call seems to work using our normal App Access Token, no insight data is returned for the post/story.
Does anyone know if this is possible and how to do it?
We have been experimenting with a normal User Access Token and the "read_insights" permissions, but with no luck. I have read some similar questions but mainly regarding page-posts (this is an App Open Graph post/story).
EDIT:
The facebook article above only refers to "Page" posts. I'm looking for analytics on individual Facebook App Opengraph Posts/stories. It seems difficult to find any good information about this, has nobody attempted this with any success?
You must add insights into a permissions/Extended permissions
Article :
Getting Page Insights
In order to obtain Page Insights via the Graph API, you must use a Page access token, and you must have the read_insights permission. Click on the link below to see this working in the Graph API Explorer.

Unable to pull most page insights metrics using Graph API

I am attempting to pull page insights metrics using the Facebook Graph API Explorer, but only a handful seem to be accessible. After failing to pull these metrics using the "read_insights" permission, I checked every box from "User Data Permissions", "Friends Data Permissions", and "Extended permissions." I still can not access most metrics.
An example GET request:
//insights/page_fans
...returns an empty dataset even though I am an administrator of this page and have permission to access to this data. I currently only get data back from: page_story_adds_unique, page_friends_of_fans, page_admin_num_posts, page_admin_num_posts_by_week.
Any insight would be appreciated.
See answer at https://stackoverflow.com/a/16894466/897489 - the default time span Facebook uses is not working because they appear to have missing data. You need to use since and until to get anything useful out.

Facebook API retrieve "All activity"

I'm looking for a way to retrieve the equivalent of what's shown on https://www.facebook.com/me/allactivity. Both FQL & Open Graph are fine.
On the graph, /me/feed shows something similar, but it's missing likes, and tags and other things.
Any ideas are appreciated.
This is currently not possible. There is no endpoint to get to this data.
The only available data will be anything that appears as a post (e.g. Youtube, Twitter). For this you can query stream via FQL. You can also try endpoints /music.listens and /video.watches but they will retrive data for the current application not all.