Blog Stats [Total Posts & Total Comments] Widget

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.

Leave a Reply

16 Comments on "Blog Stats [Total Posts & Total Comments] Widget"

Notify of
avatar
Sort by:   newest | oldest | most voted
snam
Guest

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

View Comment
Divya Sai
Guest

Give your blog link dude !

View Comment
Aneka Dunia Usaha
Guest

good job…..thank’s 4 share

View Comment
Divya Sai
Guest

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

View Comment
demo
Guest
Hugo T Gegajo
Guest

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.

View Comment
Divya Sai
Guest

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

View Comment
AK
Guest

thanks for your simple yet wonderful code 🙂

View Comment
Ms Hetal Patil
Guest

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.

View Comment
Divya Sai
Guest

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.

View Comment
Shas
Guest

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. 🙁

View Comment
Divya Sai
Guest

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.

View Comment
Anonymous
Guest
Sis-Lin
Guest

thankx 4 the tutorial. 😀

View Comment
InstinctIS
Guest

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").

View Comment
wpDiscuz