Open jakewhiteley opened 11 years ago
And just so you know - Easily the best share count plugin out there. I have hacked my version of sharrre.js to always get the counts, but I don't want this issue getting picked up by others and ruining the reputation of your awesome project because Facebook can't make their mind up.
Thanks jakewhiteley, I think Facebook remove counter when sharing = 0, see : https://graph.facebook.com/?ids=http://sharrre.com and https://graph.facebook.com/?ids=http://sharrreeeee.com
Thank you for the quick reply!
That may be true, but I was getting this on pages that 100% did have shares.
http://gkbcinc.com/the-gkbcinc-short-story-competition/ has 98 as a share total which using the Facebook developer sandbox highlighted when using FQL.
So a little more digging indicated that Facebook have stopped giving out Share counts via graph method for certain undisclosed pages as people are finding this all over the web.
Solution: Line 106:
facebook: "http://graph.facebook.com/?id={url}&callback=?",
To
facebook: "https://api.facebook.com/method/fql.query?format=json&query=SELECT+total_count+FROM+link_stat+WHERE+url+%3D+'{url}'",
then
Line 463:
else if(typeof json.shares !== "undefined"){ //Facebook count += parseInt(json.shares, 10); }
To
else if(typeof json[0].total_count !== "undefined"){ //Facebook count += parseInt(json[0].total_count, 10); }
And voila! 100% of the time share count bypassing Facebooks new 'change the way the API works but don't update the documentation' idea.
To get a result
I should also say - I was sharing a page via the sharrre plugin and the number would update.
On refresh it would be back to 0 - so this proves that it is not just for pages with 0 shares.
It appears using https://graph.facebook.com/?ids=http://your-url-here.com, now only returns a share count HALF of the time.
The other half it returns a JSON object containing the OG data for that URL but no share count, like count or comment count.
This means half of my website has 0 shares on it, and half half have shares.
I've filed a long complaint at facebook as if they are removing support from Graph of a particular function, they should roll it out all at once or not at all.
Choosing to remove share counts from some URL's only = irritating.
The alternative is using Facebooks FQL method which does still return counts everytime.
EXAMPLE: here is the JSON object returned from https://graph.facebook.com/?ids=http://gkbcinc.com/aaron-swartz-and-the-ongoing-battle-for-the-internets-soul/
No counts to be found anywhere.