开发者

Return Facebook Insight Data for Domain using JavaScript

开发者 https://www.devze.com 2023-02-21 15:34 出处:网络
I\'m looking for a very simple \"hello world\" type of example that will help me understand how to use JavaScript to retrieve the Insight 开发者_JAVA百科data for my domain.

I'm looking for a very simple "hello world" type of example that will help me understand how to use JavaScript to retrieve the Insight 开发者_JAVA百科data for my domain.

I want to return the total number of Likes (domain_like_adds) for the day on my website, but I'm not sure how to go about it. The Facebook documentation has me running in circles.

Thanks for your help!


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
});
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号