Mobile app version of vmapp.org
Login or Join
Angela700

: 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

@Angela700

Posted in: #Facebook

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

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Angela700

1 Comments

Sorted by latest first Latest Oldest Best

 

@Ogunnowo487

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

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme