Migrating Http To Https With Addthis – Retain The Social Share Count Numbers
What Is It?
It is really frustrating when you migrate your popular website from HTTP to HTTPS because you just want to add security, and suddenly your famous website pages lose the massive share counts! “Now what, Shall I be unsecured to be popular?” will be the first thought popping up in your mind. But that is not the solution, we can’t disable SSL.
I decided to keep the website on HTTPS, without worrying about the social status for a few days and spent some time researching this a bit. The problem is very simple,
So obviously the share counts will be different, and also the future shares will be tracked separately. Though I have AddThis to generate social sharing buttons and counters, it actually uses the social network’s support to do that. Then how can we fix it?
How to Fix It?
Each social network treats the shared URL tracking in diff. ways, I have verified this on Facebook and Pinterest and found that they return diff. counts for the same URL but diff. protocols. Somehow LinkedIn has this thing correct!
To check facebook’s share count, we can access http://graph.facebook.com/http://y.com, which will fetch the shares for HTTP URL. Further, Facebook reads the page URL from meta tag ‘og: URL’ and ‘canonical’ tag as suggested here and also in facebook’s help pages. But this would only fix the issue for only Facebook, for others we anyway need to find a better way.
- It allows fetching counts for Facebook, LinkedIn, Pinterest, Reddit, Delicious.
- Twitter is not supported now via Addthis or also directly, so no way to get a twitter share count for any URL!
This issue can be solved in diff. ways,
- I can show all the diff. buttons for diff. services that support dynamic button generation. This would allow fetching the latest share counts, but only for one URL as passed in the button generation code. Like it is shown here
- I can fetch HTTP and HTTPS URL share counts for all the allowed service providers mentioned above - Facebook, LinkedIn, Pinterest, Reddit, Delicious, etc. - and then show the sum as total share count. But this would also need me to keep all current HTTPS share counts for other services that are directly not supported by Addthis JS library, and this would be complicated.
- I can just fetch the HTTP share count for the same page for allowed service providers, and add them up in the existing Addthis share count value. Yes, this is it, I just need to add the HTTP share count in the current HTTPS share count and done!
- Get current https URL share count generated by Addthis. Now, this could be in 1k or 1m format, so we need to consider to convert the numbers accordingly.
- Sum them up, so now we have all the share counts. Note that Twitter and Google+ are not supporting it, so there is no way we can do that using Addthis. But we can at least get some more counts from our previous URLs.
- Check if the total share count is in a multiplication of 1k or 1m, and format the number accordingly so that we can display a bigger number in a small space if needed.
Finally, we have retained the Http URL share counts, no changes in the configurations of AddThis OR meta tags are needed.
At BoTree Technologies, we build enterprise applications with our Development team of 70+ engineers.
We also specialize in AI, ML, Ruby on Rails, Python, Django, Spree commerce, NodeJs and ReactJS.
Consulting is free – let us help you grow!
Choose Your Language
Subscribe to Our Newsletter
- Digital Marketing
- IT Consulting
- Project Management