tabalinas / jssocials

Social Network Sharing jQuery Plugin
http://js-socials.com
MIT License
464 stars 104 forks source link

Get facebook count after change adress to https:// #165

Closed zimnyd closed 7 years ago

zimnyd commented 7 years ago

Some time ago I added ssl protocol to the page. After this change all the likes are "0", That's normal, but I would like to get the sum of likes from the old "http: //" address and the new "https: //" Example for this address I have 1955 likes for http and 13 likes for https. I would like to display 1968.

{ "http://rodzinawpraktyce.pl/rodzicu-spotkamy-sie-w-sadzie/": { "share": { "comment_count": 0, "share_count": 1955 }, "og_object": { "id": "823189464466270", "description": "Bior\u0105c pod uwag\u0119 ostatnie wydarzenia, a zw\u0142aszcza \u015bmier\u0107 14 letniego Dominika, postanowi\u0142em ostrzec Was drodzy rodzice, \u017ce spotkamy si\u0119 w s\u0105dzie! Pami\u0119taj, \u017ce to Ty odpowiadasz za swoje dziecko, a ja\u2026", "title": "Rodzicu \u2013 spotkamy si\u0119 w s\u0105dzie! \u2013 Rodzina w praktyce", "type": "article", "updated_time": "2017-08-14T20:52:51+0000" }, "id": "http://rodzinawpraktyce.pl/rodzicu-spotkamy-sie-w-sadzie/" }, "https://rodzinawpraktyce.pl/rodzicu-spotkamy-sie-w-sadzie/": { "share": { "comment_count": 0, "share_count": 13 }, "og_object": { "id": "823189464466270", "description": "Bior\u0105c pod uwag\u0119 ostatnie wydarzenia, a zw\u0142aszcza \u015bmier\u0107 14 letniego Dominika, postanowi\u0142em ostrzec Was drodzy rodzice, \u017ce spotkamy si\u0119 w s\u0105dzie! Pami\u0119taj, \u017ce to Ty odpowiadasz za swoje dziecko, a ja\u2026", "title": "Rodzicu \u2013 spotkamy si\u0119 w s\u0105dzie! \u2013 Rodzina w praktyce", "type": "article", "updated_time": "2017-08-14T20:52:51+0000" }, "id": "https://rodzinawpraktyce.pl/rodzicu-spotkamy-sie-w-sadzie/" } }

Ruud68 commented 7 years ago

humm interesting case. normally, when switching to httpS you redirect all traffic targetted to http to the new httpS. This because otherwise google will 'punish' you for having duplicate content.

So the likes on the http version will not increase (as Facebook will also be redirected)

zimnyd commented 7 years ago

You're right. I received a lot of likes on posts before I changed the domain to httpS. Now all likes goes to httpS page. So now I would like to be able to sum up old and new likes. Facebook have all information. All I need is grab them.

tabalinas commented 7 years ago

@zimnyd, I don't think we want to fetch share counts for both http and https urls out-of-box, but you could patch _loadCount method so it fetches counts for both urls.

Ruud68 commented 7 years ago

Hi, following a discussion on my own forum for a user in a 'similar case' (not migrating from http to https, but migrating to different domain name) we found the following solution that might work for you as well:

it is in paragraph '2. Use the old page as the canonical URL for the new page'

https://developers.facebook.com/docs/sharing/webmasters/crawler/