But there is a problem! When a page on your website loads and demands associated comments from Disqus server, it has to make a lot of GET queries. All the comments, gravatars of commentators, support files etc, all this has to come all the way from Disqus server on to your page. As a result, the page load speed of your website decreases. Wouldn’t it be great if you could load Disqus comments on demand? For example, it would be excellent to load comments when a user clicks on a button. If user does not want to read or post comments, then there is no need to unnecessarily fetch comments from Disqus. Such on demand load of Disqus comments can be achieved by exploiting onClick event, asynchronous loading of Disqus JavaScript and/or AJAX. Let’s see how to do this. Er… wait a second… do you first want to see the demo? Well, then just scroll down this page and see for yourself. At the time of writing this article, I am also using this method of loading Disqus comments on click event. OK, now let’s see how to do this. First of all, you should do basic integration of Disqus Commenting System in your website or blog. If you’re using WordPress platform, you can easily do this integration using a plugin provided by Disqus. Otherwise also it is just a matter of including a JavaScript code provided by Disqus. Needless to say, if you’re integrating Disqus, you should remove comments section, in case it is provided by your CMS or blog platform. This is the plain method that relies on basic JavaScript. If your website is not using jQuery (I wonder why!), you can use this simple method. Here is the code: HTML JavaScript Please note the following: As most of the blogging platforms and other websites do load jQuery, you may want to take advantage of this excellent JavaScript package. Here is the code for loading Disqus on demand using jQuery and AJAX. HTML JavaScript In this code also, please don’t forget to replace [YOUR-DISQUS-SHORTNAME] with your own shortcode. This script uses AJAX to get Disqus JavaScript from server. Once the click event is triggered, the event causing button disappears. I am using this method to load comments on demand. Those who are not code-savvy people, they can make use of a WordPress plugin to load comments on click of a button. This method is not recommended because installing too many plugins also slow down your website. So, you try to avoid installing plugins whose work you can easily do on your own by tweaking code a bit. There are several advantages of using either of the given method. Let me explain:

Page load speed of your webpage increases. It takes lesser time to load and therefore, your website gains brownie points both from visitors and search engines. Your page looks much cleaner without the clutter of comments section. Total length of the page also decreases, which makes it easier for the visitor to scroll up and down the content. It will reduce comment spam. You’ll get no spam at all. If you use WordPress default comment section without captcha and/or Akismet plugin —you’re likely to get loads of spam comments. Using on demand Disqus, will leave no scope for spammer as there will not be a form available for them to fill. Comment form appears only when person clicks on the button.

There is only one disadvantage that I can think of. It’s a matter visitor psychology “out of sight, out of mind”. If a visitors sees comments right served up to him, he may be more likely to read them. Contribution in comments section is also more likely if comments section is seen by default. But if your content is so good that visitors will not bother to make an extra click for commenting, you should use this method. Comment * Name * Email * Website

Δ