I am working on a Google Blog and Disqus comments counter updates with delay up to 10 minutes. So I try to make it counts in real time. I contacted with Disqus support and they told me this...
Please note that the comment count script is not expected to update in Realtime, and can experience delays of up to 10 minutes when configured properly.
If you are looking for realtime comment counts, we do have some Advanced Options which you are free to implement on your site, though any additional questions regarding these methods should be directed towards our Developer Forum: - Use a hook to increment the displayed comment count every time a new comment comes in in real-time which would be possible to do since Disqus is already loaded in the background. To accomplish this, you could just provide a callback as described on this page:https://help.disqus.com/customer/portal/articles/466258-capturing-disqus-commenting-activity-via-callbacks and increment the count every time your callback gets called.
If you still would like to poll, try using the comment count script as described on this page: https://help.disqus.com/customer/portal/articles/565624-tightening-your-disqus-integration. Once this is loaded, you can just call the function: DISQUSWIDGETS.getCount({reload: true}); when you want to poll and it will update the comment count for you. This endpoint is heavily optimized on our end for this use case.
My problem is... Where exactly should I place this DISQUSWIDGETS.getCount({reload: true});
? Cause I have make some tries but, nothing!!!
Here is an example of my code...
Disqus comments count link:
<b:if cond='data:post.allowComments'>
<a class='disqus-comment-count' expr:href='data:post.url + "#disqus_thread"' onclick='return false;'>Counting...</a>
</b:if>
Disqus comments widget:
<b:widget id='HTML6' locked='false' title='Disqus Comments' type='HTML' visible='true'>
<b:includable id='main'>
<div id='comments' name='comments'>
<div id="disqus_thread" />
</div>
</b:includable>
</b:widget>
Disqus count.js:
<script id="dsq-count-scr" src="//my-shortname.disqus.com/count.js" async='async'></script>
Load Disqus comments on click:
<script>
$(document).ready(function() {
$('#comments').on('click', function() {
var disqus_shortname = 'my-shortname';
$.ajax({
type: "GET",
url: "http://" + disqus_shortname + ".disqus.com/embed.js",
dataType: "script",
cache: true
});
});
});
</script>