Sunday, 27 December 2009

Show posts and comments stats in Blogger


                            One of the best widget is to show total number of blog posts and number of reader comments on your blog . For showing the number of posts and comments if the number is too huge and on top if your blog is DO-FOLLOW , its very useful . By blog statistics, this statistics widget displays the total number of posts and the total number of comments made on your blog as a widget that can displayed anywhere in blog and is live real time , thats  if anyone comments or blog admin posts , then the stats update at once and therefore one of the best blogger hack !
This widget works using javascript ( the json feeds) which calculates the number of comments and posts from your blogs feed , the Atom one and not RSS one

This is only for Blogger
not wordpress or joomla or livejournal as there are many  plug-ins available for that !
This code is very light weighted and efficient and does not take any time to load blog slower .
Adding HTML coding requires just a minute to add in Blogger

To add this widget go to  
  • Layout  
  • Add a Gadget  
  • HTML/JAVASCRIPT  
and
add da code shown below

<script src="http://www.qwertyweb.blogspot.com/feeds/posts/default?orderby=published&alt=json-in-script&callback=rp"></script>

<script style="text/javascript">
function numberOfPosts(json) {
document.write('Total number of Posts: <b>' + json.feed.openSearch$totalResults.$t + '</b><br>');
}
</script>
<script src="http://www.qwertyweb.blogspot.com/feeds/posts/default?alt=json-in-script&callback=numberOfPosts"></script>
<script src="http://www.qwertyweb.blogspot.com/feeds/comments/default?orderby=published&alt=json-in-script&callback=rp"></script>

<script style="text/javascript">
function numberOfComments(json) {
document.write('Total number of Comments: <b>' + json.feed.openSearch$totalResults.$t + '</b><br>');
}
</script>
<script src="http://www.qwertyweb.blogspot.com/feeds/comments/default?alt=json-in-script&callback=numberOfComments"></script>



Just replace qwertyweb by your blog name
Digg Google Bookmarks reddit Mixx StumbleUpon Technorati Yahoo! Buzz DesignFloat Delicious BlinkList Furl

0 comments: on "Show posts and comments stats in Blogger"

Post a Comment