Visualizing my writing goals with live stats

A live dashboard shows how many posts and words are in this blog. Why and how I built it.

I just added a Blog stats page to this site, which features a live dashboard that shows how many posts and words are in this blog. (Yes, meta.)

This is an image! Visit the Blog stats page for the real thing.


This dashboard was in part inspired by two things I came across:

  • Jim Collins' system for tracking his "creative hours", with a goal of hitting 1000 hours per year. (Picked up from this excellent podcast episode with Tim Ferris.)  => This made me think: if I want to get better at writing, I ought to track some metric.
  • A parable from the book Art & Fear about a ceramics teacher who split the class into two groups: 1) a group who would be graded solely on the quality of a single pot they made, and 2) a group that would be graded solely on the quantity—in pure weight—of pots they made. The higher the quantity, the higher the grade. At the end of the semester, ironically the "quantity" group had the highest-quality pots. Thus: the importance of putting in the reps. (citation) => This made me seek to track input/effort metrics in particular.

How I built the dashboard

Unsurprisingly, I built this dashboard in Retool. Here's the code so you can set one up too, or just follow along.

In short, there were three main steps:

  1. Creating the UI. I kept it simple. This UI is just three Containers, 4 Statistics, and 1 Table component in Retool.
  2. Pulling in the blog post content using the API. This was one HTTP call to the Ghost Content API.
  3. Deriving statistics based on the retrieved blog data. These were very simple to code up by writing Javascript to parse the HTTP response. For example, here are the two steps that get me the total word count:
get_posts here is the HTTP call to the Ghost Content API.
Here, we reference the posts_with_stats we computed above.

How this dashboard could be improved

This was a quick and dirty first draft, but enough to get me off the ground. It took less than 20 minutes, from start to finish, to build.

There are definitely things that could be better:

  1. Expand the set of stats I'm showing. I might want to break down how many words I'm writing in different categories (like personal, versus collaboration systems).
  2. Data fetching. Right now, I don't have enough blog posts to need to paginate the fetch from the Ghost API. But with enough work, I will. This is easy to do.
  3. Crunch the stats offline. Right now, the stats of computed on the fly in the app when you load it. Another option is to fetch the data and compute the statistics "offline", rather than in the app.
  4. A smarter word count. Right now, I'm doing a simple .split(' ').length (as you can see from the code snippets above). This isn't a perfect word count algorithm, especially when parsing HTML. But good enough for an MVP.

Hopefully, as I write more, I'll need to solve some of these problems.

Subscribe to Growing in Public

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.