João
João

Reputation: 633

How to access data from Facebook Insights for domains?

I've read that it is possible to access Facebook Insights programmatically:

The Graph API provides programmatic access to all of this data so you can integrate Platform data into your own, custom analytics systems.

I have two questions, though:

  1. Is it possible to access data from a domain, using Facebook Insights for domains?
  2. How to get data from a public URL? I've wrote this small script that returns the number of shares for a given URL without using data from Facebook Insights for domains, but how do I get all possible information from a given URL (e.g. who shared it, who liked it, who commented, etc)? Is this even possible?

Upvotes: 1

Views: 1524

Answers (1)

Simon Cross
Simon Cross

Reputation: 13345

To get insights for a domain, get the read_insights permission, then GET

https://graph.facebook.com/insights?domain=example.com&access_token=TOKEN

To get insights for a particular URL on your domain, GET

https://graph.facebook.com/?id=YOUR_URL&access_token=TOKEN

Not all of the data you want is available - for example, you can't get the UIDs of the users who shared and liked your URL, but you can get the count.

If you have the comments plugin embedded on your URL, you can get the UIDs of the users who have commented on your URL as comments in the plugin are always public.

Upvotes: 2

Related Questions