3

我正在寻找一个非常简单的“hello world”类型的示例,它将帮助我了解如何使用 JavaScript 来检索我的域的 Insight 数据。

我想在我的网站上返回当天的喜欢总数(domain_like_adds),但我不知道该怎么做。Facebook 文档让我绕着圈子跑。

谢谢你的帮助!

4

1 回答 1

0

See this page for more information on how to define your query:

http://developers.facebook.com/docs/reference/fql/insights/

Here's the basic query and facebook JS API query with callback function:

var insight_domain = "http://www.mydomain.com";

var insight_query = "SELECT metric, value FROM insights where metric="domain_like_adds" AND end_time=end_time_date('2011-04-06')  AND period=period('day') AND object_id in (select id from object_url where url ='{0}')";

var query = FB.Data.query(insight_query, insight_domain);
query.wait(function(data) {
  //process your insight data here
});
于 2011-04-07T06:49:58.457 回答