Graph API Version
Page Insights
Page Insights
Insights Edge for a Facebook Page.
Global brand default Page returns its own insights data, while root Pages return integrated insights of the whole hierarchy of Pages.
Reading
This Page's Insights data. Global brand default Page will return its own insights data, while root Page will return integrated insights of the whole hierarchy.
GET /v2.8/{page-id}/insights HTTP/1.1
Host: graph.facebook.com/* PHP SDK v5.0.0 */
/* make the API call */
$request = new FacebookRequest(
$session,
'GET',
'/{page-id}/insights'
);
$response = $request->execute();
$graphObject = $response->getGraphObject();
/* handle the result *//* make the API call */
FB.api(
"/{page-id}/insights",
function (response) {
if (response && !response.error) {
/* handle the result */
}
}
);/* make the API call */
new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/{page-id}/insights",
null,
HttpMethod.GET,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
/* handle the result */
}
}
).executeAsync();// For more complex open graph stories, use `FBSDKShareAPI`
// with `FBSDKShareOpenGraphContent`
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
initWithGraphPath:@"/{page-id}/insights"
parameters:params
HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
id result,
NSError *error) {
// Handle the result
}];Permissions
Developers usually request these permissions for this endpoint:Marketing Apps
read_insights
read_page_mailboxesread_insightsmanage_pagespublish_pagespages_show_listpages_manage_ctapages_manage_instant_articlespages_messagingpages_messaging_phone_numberpages_messaging_subscriptions
Permissions are not usually requested.
Parameters
| Name | Description |
|---|---|
metriclist<A valid metric for an insights endpoint> | The list of metrics that needs to be fetched |
periodenum{day, week, days_28, month, lifetime} | The aggregation period |
sincedatetime | Lower bound of the time range to consider |
untildatetime | Upper bound of the time range to consider |
Fields
Reading from this edge will return a JSON formatted result:
{ "
data": [], "paging": {} }
data
A list of InsightsResult nodes.paging
For more details about pagination, see the Graph API guide.Validation Rules
| Error | Description |
|---|---|
| 100 | Invalid parameter |
| 3001 | Invalid query |
| 190 | Invalid OAuth 2.0 Access Token |