Mobile Number Tracker
Trace Mobile Number Earn Money Online
© TechWelkin.com

Slow AddThis: Reason and Solution

Asynchronous loading of JavaScript can make your website load faster.
Samyak Lalit | February 25, 2012 (Last update: September 23, 2017)

Samyak Lalit is an Indian author and disability rights activist. He is the principal author and founder of projects like TechWelkin, WeCapable, Viklangta, Kavita Kosh among many others.

AddThis is one of the leading bookmark services on Internet. Millions of websites around the world use this service to display social networking and sharing buttons like Facebook, Twitter, Google+ etc. There is no doubt that AddThis is a useful service and it makes it easy to spread the word about your website –but a number of webmasters do experience slow load speed after they have installed AddThis plugin / widget.

If you are using AddThis script as provided by AddThis –there are high chances that your website will take significantly higher time to load. You may learn that the addthis_widget.js script from s7.addthis.com server is taking too much time to load.

Let’s investigate the issue and see what is the solution for this.

Why does AddThis slow down your website?

In order to display social network buttons on your website you need to integrate a piece of AddThis JavaScript in your website’s code. This makes your site dependent upon the speed of AddThis server because your website has to fetch the JavaScript from there. If their server will be slow —your website will also be slow. Moreover, placement of AddThis code in your website may also hamper loading as browsers will wait for AddThis code to fully load before proceeding ahead.

Asynchronous loading of JavaScript can make your website load faster.

Asynchronous loading of JavaScript can make your website load faster.

Load faster with AddThis asynchronous (async) mode

The solution to get rid of this slowness is to load AddThis script in asynchronous mode. This would prevent AddThis from loading other assets except the initial script. After loading this initial script your website will break connection with the AddThis server and load itself further. When your website’s Document Object Model (DOM) will be fully loaded, then you can call the init() function of AddThis JavaScript to resume loading of the remaining AddThis assets.

To do this, just add the following parameters to your script call:

async=1&domready=1

So, instead of the following code:

<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=xa-4f3e33c72b9a4e40"></script>

Use this one (change the pubid parameter to your pubid):

<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=<YOUR-PUB-ID>&async=1&&domready=1"></script>

And then call the init() function right before closing the body tag:

<!-- Call for AddThis init() function -->
<script>
    function initAddThis()
     {
          addthis.init()
     }
     initAddThis();
</script>

If you do this, you’ll see that your AddThis plugin / widget is loading faster than before. Of course there could be other reasons that might be slowing down your website. You should look into those reasons separately. Slow websites are not considered quality websites by Google.

I hope this helped! Let me know your comments on this!

© TechWelkin.com

16 responses to “Slow AddThis: Reason and Solution”

  1. Sujata says:

    Thank you….

  2. sunil says:

    Which is the best plugin for wordpress to add social sharing buttons ?

    • Lalit Kumar says:

      Hi Sunil, there are many good options available for social share buttons on a WordPress blog. I would not really recommend any but I can say that you should select a plugin that is fast to load. Social share plugins often slow down your website. Slowness in loading website is not a good thing as it gives the visitor a bad experience.

  3. shan says:

    really ur coding safe my life…thank u so much

  4. Christopher Ohlsen says:

    I had given up on Addthis for this reason. Even with CDN site was loading slower with the widget… I think because it was loading before before the site. I just implemented this, cleared my cache, and voila! Now, site is still loading fast and addthis is loading after the site… it’s like a lazy load method for Addthis. Awesome! Thank you very much!

  5. SEO Learner says:

    Thanks for the info, i was above implement the code. Will try it without the codes given by you. Once if i feel addthis has affected the server load than try your code.

    Thank you

  6. RealFitness says:

    And your Addthis in this BLOG doesn’t make the .js after .css hahahahahahahhaa very well, i wait your replies…

  7. RealFitness says:

    The solution doesn’t work, if i use &async=1&domready=1 or &async=1&&domready=1, addthis make after .css but it doesn’t show any buttons, if i call the init() function right before closing the body tag addthis .js make before .css.

    Thanks but doens’t work :(

  8. Anonymous says:

    How does this work in WordPress?

  9. gui says:

    i love you so much

  10. LinuXplained says:

    Thanks! much more clearer than AddThis support pages.

  11. Stéphane Bidouze says:

    thanks for this trick, i have just a little problem: i don’t know where to change these lines!!
    can you give me the name of the file and where to find it???
    regards

  12. Jake says:

    Thank you so much:)

  13. Carlos Ruiz says:

    thank you !!

Leave a Reply

Your email address will not be published. Required fields are marked *