I have made sure that the user has 'read_insights' permission. I also have 'manage_pages' permission. I receive no errors which is kind of annoying as it woud help.
All I ever get is an empty array. The Graph API works just fine, returning correct data every time.
FQL does not work, and I have never got Insights from it yet. Either they have a bug or I'm doing something wrong.
I have this code to get some Insights:
$('.page-entry>a').live('click', function(e) {
e.preventDefault();
var id = $(this).parent().attr('id');
FB.api(
{
access_token: accessToken,
method: 'fql.query',
query: 'SELECT metric, value FROM insights WHERE object_id = ' + id + ' AND metric="page_impressions" AND end_time=end_time_date("2012-06-01T07:00:00+0000") AND period=period("month")'
},
function(data) {
console.log(data);
}
);
})
The user is logged in, and I can see all of their pages/apps fine. I have the id's and even access_tokens for each page. I tried that for FQL, it didn't work.
Any help appreciated.