1

Trying to setup an analytics dashboard for a client. I need to get the page insights total views, reach, and engagement.

In the Graph API Explorer I tried to request read_insights after submitting the page id from my app for this project. I am able to request many fields but when I try read_insights (which is required for the analytics data I need) it gives me this error.

(#100) Tried accessing nonexisting field (read_insights) on node type (Page)

I also get this error information along with it

"type": "OAuthException",
"code": 100,
"fbtrace_id": "D/HzJo9q/T9"

The user I am logged in with is the administrator of the app and the page.

I also have the access_token field enabled.

How do I get read_insights on this page?

Cyberio
  • 65
  • 2
  • 11
  • You are confusing fields with permissions. – CBroe Jun 23 '17 at 07:39
  • I did see that read_insights was a permission that I could get for the user and I did turn that on but wouldn't it activate insights fields in the sidebar? I do see one called "insights" but it is clearly not the analytics information. None of the page_views_total or other insights metrics are available. – Cyberio Jun 23 '17 at 12:27
  • No, that doesn’t “activate” anything in Graph API Explorer. The metrics are “below” the insights edge, so you have to select that first, and then a metric below that. Or you just write the request “by hand”, you do not _have to_ rely on the Explorer autocomplete feature ... – CBroe Jun 23 '17 at 12:31
  • So, if I have read_insights and manage_pages and select the insights field I should be able to manually add page_views_total? – Cyberio Jun 23 '17 at 12:34
  • 1
    `/page-id/insights/page_views_total` is basically all you need. You can combine that with other fields/edges, if you need to get more data from the page in one go, using the field expansion syntax (see chapter on basic API usage) ... but for the basic request in itself, that will do. – CBroe Jun 23 '17 at 12:36
  • Thank you! Would you like to put together the answer to this question so I can accept it? – Cyberio Jun 23 '17 at 12:53

1 Answers1

2

The error message you initially got simply means you are confusing fields with permissions.


/page-id/insights/page_views_total is basically all you need, if you want to get a single metric.

If you need more metrics, you can list them comma-separated, like so:

/page-id/insights/page_views_unique,page_views_total

You can combine that with other fields/edges, if you need to get more data from the page in one go, using the field expansion syntax (see chapter on basic API usage) ... but for the basic request in itself, that will do.

CBroe
  • 91,630
  • 14
  • 92
  • 150