Blog Stats [Total Posts & Total Comments] Widget


Here's another simple widget for your blog. With this widget, you can show your live stats (total posts and comments on your blog).
You may change the phrases "Total Posts" and "Total Comments" and the color of the font too.
Follow these instructions to add a similar widget to your blog:
Log in to Blogger, go to "Layout", click on "Add a Gadget", and select it as "HTML/JavaScript" type. Now add this code to the widget:
<script style="text/javascript">
function numberOfPosts(json) {
document.write('Total Posts: <b>' + json.feed.openSearch$totalResults.$t + '</b><br>');
}
function numberOfComments(json) {
document.write('Total Comments: <b>' + json.feed.openSearch$totalResults.$t + '</b><br>');
}
</script>
<font color="red"><script src="http://bloggerstop.net/feeds/posts/default?alt=json-in-script&callback=numberOfPosts"></script>
<script src="http://bloggerstop.net/feeds/comments/default?alt=json-in-script&callback=numberOfComments"></script></font>

Replace the code in red with your blog's address.
And you may change the code highlighted in blue to modify the appearance of this widget.

ProBlogger - Inspiring Others Realize Their Dreams!

Share this

Related Products

Related Posts

Previous
Next Post »

16 comments

Write comments
April 04, 2009 6:27 AM delete

For some reason it doesn't work on my test blog. Is it because I have another widget that does this also?

Reply
avatar
April 04, 2009 7:10 AM delete

Give your blog link dude !

Reply
avatar
April 04, 2009 11:31 AM delete

http://www.testblogsnam23.blogspot.com/

Reply
avatar
April 04, 2009 12:36 PM delete

Dude that blog's taking too much of time to load, may be because of the number of widgets in it !
As this widget is very easy to add, and hardly takes time, so I advice you to directly try it out in the final blog where you want to put it....

Regards
Sai

Reply
avatar
April 06, 2009 8:01 AM delete

I am very new to blogging but your site helped me a lot. Thanks very much. I visit your site every to get tips on how to improve my site.I follow your tips one at a time. Thanks again.

Reply
avatar
April 06, 2009 10:52 AM delete

Welcome Hugo......I am glad you were here buddy !

Reply
avatar
AK
December 02, 2009 2:34 PM delete

thanks for your simple yet wonderful code :)

Reply
avatar
December 08, 2009 8:54 AM delete

Sai Ram Divya,

I have been using this widget since the day it was posted. But now comments count is not working properly, I mean comments are displayed less as compared to actual ones. Please help.

Reply
avatar
December 08, 2009 8:59 AM delete

Yeah that's true, and this is not limited to this widget but the count is faulty in the popular posts widget too. The problem is not with any of these widgets, rather something is wrong at Blogger itself. May be something is being edited in the feedlinks.

Reply
avatar
March 04, 2010 3:54 PM delete

I am having problem with this widget. It is not showing the actual total number of comments. It was somewhere is 1000s n now it is showing it in 100s. :(

Reply
avatar
March 07, 2010 2:53 PM delete

Yes Shas, even I am facing that problem. And that is why I stopped using it. Actually the problem isn't with the widget but with the feed itself. Hope it's just a temporary problem.

Reply
avatar
April 12, 2010 7:44 AM delete

thankx 4 the tutorial. :D

Reply
avatar
October 21, 2011 6:34 AM delete

Since recent changes on Google, the PageRank checking became an isue, yet it can still be checked by this free tool: http://domof.com . Use the returned seo information wisely and save it as pdf file for refference (look for a button: "Seo Report - Download").

Reply
avatar

Comments are moderated on this blog

Allowed HTML tags: <b>, <i> and <a>

Comment Like This! and Optimize your blog EmoticonEmoticon