0

I need to be able to query the Facebook Insights API to get the page views for a clients Facebook Page. After reading through plenty of documentation, I've managed to make a call using a user access token to the API using this call:

dynamic result = client.Get("{clientspageid}/insights/page_views/");

This works fine, except for it only returns 3 days of results which always seems to start 2 days before the date of request. So for example, today is the 18th, but the results will show views for the 16th, 15th and 14th. I saw there was a parameter that can be added to specify the period, so I started using the following:

dynamic result = client.Get("{clientspageid}/insights/page_views?period=week/");

For some reason this returns no data. I've tried 'month' and 'lifetime' and get the same result. Any idea what I may be doing wrong and why the API seems to return on 3 days of results if a period is not specified? I need to return a weeks worth of results for my client.

envio
  • 1,155
  • 1
  • 9
  • 13

2 Answers2

1

You can use "since" and "until", but only for a limited period (35 days) :

client.Get("{pageid}/insights/page_views?period=week&since=2016-01-25&until=2016-01-30")

See this post: https://developers.facebook.com/blog/post/478/

Cedric
  • 431
  • 5
  • 13
0

How did you obtain a user access token? Have you tried with Graph api explorer first? There are 3 results but you can go "next" and see the next 3 results.

Marko
  • 19
  • 3
  • I used the method outlined in this link to obtain the token: http://stackoverflow.com/questions/17197970/facebook-permanent-page-access-token. Just noticed the 'next' link. I will see if that will bring back the results I require. – envio Mar 24 '15 at 09:37