How To Get Historical "Facebook Page Likes" Data via Graph API or FQL

38,765

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.

Share:
38,765
Georg
Author by

Georg

Updated on January 22, 2020

Comments

  • Georg
    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
    Georg about 12 years
    I've considered that for the future but how could I access that data from the past?
  • Nix
    Nix about 12 years
    You need insights access. Do you know the people who own the pages?
  • Georg
    Georg about 12 years
    No, I ask for the page username in the first step and send that to file_get_contents, which pulls the data.
  • Nix
    Nix about 12 years
    Pretty 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
    Georg about 12 years
    Can you please explain"GAE project"? Cheers.
  • Nix
    Nix about 12 years
    Google 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
    Georg about 12 years
    Nice one. I might give that a shot. Thanks again!
  • Noam
    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
    Marko K over 2 years
    The question was about getting the number of page likes, not views.