Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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 http://www.facebook.com/sharer.php?u= and the JavaScript file on my page is this http://static.ak.fbcdn.net/connect.php/js/FB.Share

I haven't changed anything and this has worked for years

share|improve this question

1 Answer 1

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

share|improve this answer
    
Brian for the rest of us who have now clue how the results of count is integrated in to the new SDK process, can you point us to the right page that shows us how the ingratiation process looks like on a real FB.ui exmaple? When I go there - developers.facebook.com/docs/sharing/reference/feed-dialog/v2.2 there is no training in integrating count into FB.ui –  blackhawk May 14 at 22:33
1  
Im pretty sure seeing the current users personal share count, if thats what you're referring to, is a privacy no no and the share dialogue relates directly to a user sharing not the shared content. So if you want to see how many times the url you're sharing has been shared simply make a GET request to fb graph graph.facebook.com/?id=http://google.com –  Brian Dillingham May 15 at 4:03
    
Thank you so much Brian, can I use javascript to pull these values onto my personal page? –  blackhawk May 15 at 11:39
    
@blackhawk no problem and yes an ajax request is perfectly suitable. –  Brian Dillingham May 15 at 13:32
    
@blackhawk updated my answer to include some example jQuery –  Brian Dillingham May 16 at 2:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.