AddThis Academy

An ever-growing library of resources to help you become a better online marketer.

HTTP to HTTPS: How Share Counts Are Affected


Update: As of August 17, 2018, AddThis sharing buttons will automatically request the share count numbers for the HTTP and HTTPS version of a URL from social networks that support share counts. The share count displayed with your buttons will be the sum of all share counts for a page, before and after the HTTPS switch. If you have already installed the workaround code below on your site you can now remove it. 

Share counts are based off of the exact URL and unfortunately, the APIs for each of the service providers treat the protocol (http/https) as distinct URLs.

Rather than showing the same count for both http and https sites, counts are different based on the exact URL and protocol (http vs https). Unfortunately, we have no control over how these services handle counting shares, so share counts are going to be different for http and https.

This is also the case if you set have a 301 redirect on your site to redirect users from http to https. Facebook will crawl the http page, see the redirect, and then update their internal share counter system to show the new URL and reset the share counts.

The Workaround

To workaround the issue, you could add some additional code to the site, which will set the URL that the share counts are obtained for. This will also use the http URL when visitors share the page, so you’ll want to make sure you have a 301 redirect in place to redirect visitors to the https version.

Floating Sidebar
If you use the floating sidebar sharing buttons, the code below should be placed at the very bottom of your site’s source code, just before the </body> tag and after any existing AddThis code.

<script type="text/javascript">
if (window.location.protocol === 'https:') {
    if (addthis) { 
        var addthis_share = addthis_share || {};
        addthis_share.url = window.location.href.replace('https://','http://');

Inline Share Buttons
If you are only using the Inline Share Buttons, the code above is not needed. Rather, you’d need to add the data-url attribute and specify the http version of the URL.

Note: The class name (addthis_inline_share_toolbox) shown below may be different in the code you were provided from the AddThis dashboard.

<div class="addthis_inline_share_toolbox" data-url="THE HTTP URL">