Weekly Hack: Show your Live Stats

If you want to impress your readers that you've posted numerous articles then this widget is for you.

Example:

Total Posts: 2654
Total Comments: 3235


Follow the steps and you'll be amazed to what this widget can do. :D
  1. Click Layout > Page Element > Add a Gadget
  2. Find the HTML/Javascript and click add.
  3. Copy the code below and paste it there.
    <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="black"><script src="yourblogurl/feeds/posts/default?alt=json-in-script&callback=numberOfPosts"></script>
    <script src="yourblogurl/feeds/comments/default?alt=json-in-script&callback=numberOfComments"></script></font>

  4. Replace yourblogurl with your link
  5. Save

You can tweak it if you like. :p

2 comments:

July 26, 2009 at 11:07 PM liebestraume said...

what a cheat. haha. cool.

keep it up with the posts. :)

Post a Comment