How to Add Your WordPress Stats to Panic’s Status Board

I’ve been digging Panic’s Status Board and follow the @StatusBoardInfo feed for new sources. Oliver Schwarten — @Osch_ — shares on his blog how to display your WordPress stats. Unfortunately, his post is in German, but with the help of Google Translate and some googling to help with command line functions, I figured out how to make this work for me. Nothing I am sharing here is original, but it took me several tries to figure out the /path_to/ address for the csv file I needed to write to my server, so I thought I’d share my process.

Get Your WordPress API

If you have WordPress stats in your dashboard, then you will have had to sign up for an API key. If you are signed in with your wordpress.com account, you can get your key here.

Use the Stats API to Output a CSV File

You need a csv file to create a chart in Status Board.

The following outputs in the browser a csv file displaying the views on your blog for the last five days:

http://stats.wordpress.com/csv.php?api_key=YOUR_API_KEY&blog_uri=YOUR_BLOG_URL&table=views&days=5&limit=-1

Run a Cron Job on Your Server

To the best of my understanding, Schwarten states that this is a static file, so you need to update it at regular intervals. He uses cron and cURL to do this.

I don’t work in Terminal, but if your blog runs on a server that has cPanel installed, you can go to the cron jobs page, create a cron job, and enter something like the following:

curl -s "http://stats.wordpress.com/csv.php?api_key=YOUR_API_KEY&blog_uri=YOUR_BLOG_URL&table=views&days=5&limit=-1" > /home/USERNAME/public_html/wordpress.csv

and set some time interval at which you will run this command.

The path to which I was writing the csv file tripped me up, but I figured out that /home/USERNAME/public_html/wordpress.csv works for me. USERNAME is the name that you use, for example, to log in to FTP for your account, or whatever shows up after the ~ following your site’s IP address.

Display Your Stats

In Status Board, tap on the table icon, and add YOUR_BLOG_URL/wordpress.csv. It will show a chart showing your blog’s recent views. For example, here’s the csv file for one of my blogs.

Other Stats You Can Show

This page shows other variables you can use for the API. For example, you can create a table showing referrers or search terms, and write to a different URL, and enter that in Table view in Status Board.

Comments

  1. Yes, everything is correctly reproduced. Good job! :-)
    I forgot to mention in my blogpost that the user should take a “more secret”
    folder and filename than wordpress.csv.

    • Jeffrey Kishner says:

      Good point. If you don’t want somebody to know your stats, that can be a pretty obvious address.

  2. Nice one! Gonna try it out later today when I get home from work. Btw I did something similar myself, creating a panel to show downloads stats for your (well…any!) wordpress plugins. Perhaps it’s of interest:

    http://simple-fields.com/2013/status-board-panel-to-show-wordpress-plugin-downloads/

Leave a Reply to Jeffrey Kishner Cancel reply

*