How To Get Historical "Facebook Page Likes" Data via Graph API or FQL
Solution 1
Without insight permission I recommend that you write something to perform a nightly query on the page graph and record the stats you need. If the page is public most of the information shown on that site is available.
You could also scrape info from http://pagedata.appdata.com if the page has already been listed...
Solution 2
https://graph.facebook.com/{{pagename}}/insights/page_views?access_token={{access_token_key}}&since=1420070400&until=1421625600
Since & until parameter in the above code takes in unix time. add necessary information in the {{ }} and this code should work.
Georg
Updated on January 22, 2020Comments
-
Georg over 4 years
Was wondering if anyone knows how to get the historical data for any Facebook Page.
For example, number of fans for RedBull fan page on a given day in the past or for a given period that ends today so that I can show fan development of any page over a given period.
I tried it with the graph API and FQL (insights) but no luck.
https://graph.facebook.com/{USERNAME}/insights?fields=likes&period('week')&end_time_date('2011-06-26') --> empty result
Pulling the data via FQL also returns no results, plus it seems without a read_insights permission nothing is possible for page data
I'd need this to be available with only a generic user access token. This data is publicly available anyway. Result should be somewhat like this: http://www.socialbakers.com/facebook-pages/australia/
-
Georg about 12 yearsI've considered that for the future but how could I access that data from the past?
-
Nix about 12 yearsYou need insights access. Do you know the people who own the pages?
-
Georg about 12 yearsNo, I ask for the page username in the first step and send that to file_get_contents, which pulls the data.
-
Nix about 12 yearsPretty much all you can do is pay for it, scrape it, or collect it yourself. You could setup a GAE project to do it in less than 20 mins.
-
Georg about 12 yearsCan you please explain"GAE project"? Cheers.
-
Nix about 12 yearsGoogle App Engine. Its a platform that allows you to create and host (free) projects. They offer built in things like cron jobs (daily, weekly, monthly, whatever you want) and free storage. If you use python they have a django distro that works nicely.
-
Georg about 12 yearsNice one. I might give that a shot. Thanks again!
-
Noam over 10 years@Nix if you'd do a nightly query to a hugh amounts of pages (like pagedata has) wouldn't fb rate-limit these calls? how do u assume they overcome such issues?
-
Marko K over 2 yearsThe question was about getting the number of page likes, not views.