: Facebook Share Button and Counter no longer displaying any Count Is it just me or did the Facebook Share button that displays the count of shares and likes just stop working over the past
Is it just me or did the Facebook Share button that displays the count of shares and likes just stop working over the past few days? The sharing still works, the count of shares no longer displays.
The link that is generated look like this www.facebook.com/sharer.php?u= and the JavaScript file on my page is this static.ak.fbcdn.net/connect.php/js/FB.Share
I haven't changed anything and this has worked for years
More posts by @Angela700
1 Comments
Sorted by latest first Latest Oldest Best
The feed dialog, in conjunction with FB.ui, is the new way to accomplish this when using the Javascript SDK. You should considering updating to the new SDK. At which point, you'd be able to display the share count of each url on your site by using Facebook's Graph API. Example Below.
Here is an object the graph API returns for google.com. Notice the total share count.
{
"id": "http://google.com",
"shares": 12265103,
"comments": 10121
}
If using something like jQuery, a simple GET request can retrieve the above JSON
var shareUrl = 'http://google.com';
var endpoint = 'http://graph.facebook.com/?id=';
var fbSharer = 'https://www.facebook.com/sharer/sharer.php?u=';
$.get(endpoint + shareUrl, function(data){
$('a[href="'+ fbSharer + shareUrl +'"] .count').text(data.shares);
});
Assuming some HTML like:
<a href="https://www.facebook.com/sharer/sharer.php?u=http://google.com">
<span class="count">0</span>
Share Me
</a>
jsfiddle Demo
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.