Links.getStats

From Facebook Developer Wiki

Jump to: navigation, search

Contents

Description

Returns information about one or more Facebook Share implementations.

Because of data caching reasons, you can make this API call only once every 2 minutes for a given Share URL.

Getting Share Statistics Directly from a Browser

You can also call links.getStats directly from your browser. To do so, pass this URL:

http://api.facebook.com/restserver.php?method=links.getStats&urls=facebook.com,developers.facebook.com

Note: You must URL encode the URL. For example, if you want to share http://www.facebook.com/connectnews?v=app_4949752878
, you would encode it as:

http%3a%2f%2fwww.facebook.com%2fconnectnews%3fv%3dapp_4949752878

Parameters

RequiredNameTypeDescription
required urls string A comma-separated list of Facebook Share URLs for which you want to get data.

Example Requests

This is using the PHP library

$facebook->api_client->links.getStats("facebook.com,developers.facebook.com");

Response

This call returns an array of link_stat information about your Facebook Share implementation.

Example Return XML

<links_getStats_response xsi:schemaLocation="http://api.facebook.com/1.0/ http://api.facebook.com/1.0/facebook.xsd" list="true"> <link_stat> <url>facebook.com</url> <share_count>19183</share_count> <like_count>1</like_count> <comment_count>6</comment_count> <total_count>19190</total_count> <normalized_url>http://www.facebook.com</normalized_url> </link_stat> <link_stat> <url>developers.facebook.com</url> <share_count>67</share_count> <like_count>0</like_count> <comment_count>0</comment_count> <total_count>67</total_count> <normalized_url>http://developers.facebook.com</normalized_url> <click_count>0</click_count> </link_stat> </links_getStats_response>

FQL Equivalent

FQL queries take the form: SELECT <fields> FROM <table> WHERE <conditions>

This function is similar to doing the following FQL query, with the appropriate parameters filled in (for example, using your Facebook Share URL in place of YOUR_SHARE_URL):

$facebook->api_client->fql_query('SELECT share_count, like_count, comment_count, total_count FROM link_stat WHERE url="YOUR_SHARE_URL,YOUR_OTHER_SHARE_URL"');

See Also

reference