Facebook integration is by now ‘a must’ for websites. By providing tools to share or like your site to Facebook, it gives your site a lot more opportunity to get read and seen by the 500 million ++ users of Facebook. Facebook has developed several simple to use API’s for this which can be found here: http://developers.facebook.com/docs/guides/web.
Statistics can be monitored in http://www.facebook.com/insights, however the data presented is far from complete. For example, something as simple as monitoring how many people has “shared” or “liked” your website is not easily determined. Fortunately there’s a handy link for checking the number of Facebook “likes” or “shares” of a given Web Page URL also provided by Facebook but not as known:
The above query will return an XML document in the following format:
<?xml version=”1.0″ encoding=”UTF-8″?>
<links_getStats_response xmlns=”http://api.facebook.com/1.0/” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=”http://api.facebook.com/1.0/ http://api.facebook.com/1.0/facebook.xsd” list=”true”>
This can then be parsed by a simple application to store the statistics in a database.
For example in PHP you can use the simlexml_load_file to parse this. Below is a very simple code (admittedly not very elegant, but it works) to do this:
$url = “http://www.eacomm.com”;
$xml = simplexml_load_file(“http://api.facebook.com/restserver.php?method=links.getStats&urls=$url”);
You can now store the shares, likes, etc. in a database and monitor for yourself how your website is performing in Facebook.
Below is a form to check if your site has been ‘shared’ in Facebook: