OCD Plugin Stats and the WordPress.org Statistics API

What you get when you don't use an API
What you get when you don’t use an API

The current version of my WordPress OCD Plugin Stats plugin, is somewhat… clunky.1 When I wrote it I didn’t know that WordPress.org had an API for it’s plugin statistics.2 Thus, the current version essentially scrapes particular WordPress.org plugin pages for information and drops it into the WordPress dashboard.

After poking into the stats on one of my plugin pages the other day I discovered that the source code for the page included several calls to a WordPress.org API.  Why should I bother scraping and interpreting a page of HTML when I can just ask WordPress.org to deliver the exact data I need in a nifty JSON format?!  I’m very much looking forward to adjusting this plugin to use a more direct and simple call to the WordPress API rather than scraping plugin pages.

In any case, if you’re looking for documentation on this, I found a page in the WordPress Codex and a site with a page devoted to documenting the WordPress.org API.

Default Series Title
  1. Photo courtesy of peasap []
  2. Apparently they have more statistics than just on plugins []

Apparently WordPress.org serves up even more delicious download stats

Lovin' that source code
Lovin’ that source code

While looking at the source code on my Simple Series plugin page, I began to wonder how WordPress.org was serving up all those nifty little stats into the downloads graph. ((Photo courtesy of Windell Oskay)) What I discovered is that there’s a little bit of jQuery magic going on that pulls download data from a WordPress.org API, formats it for niftiness, and inserts it into the dynamically draw SVG graphic of the downloads.

In case you’re interested, the API call looks like this:

http://api.wordpress.org/stats/plugin/1.0/downloads.php?slug=simple-series&limit=700&callback=?

I’m now wondering how I can use that data to show something interesting in my OCD Plugin Stats plugin.1

Default Series Title
  1. I should probably rename the meta plugin. []

WordPress plugin – OCD Plugin Stats

OCD Plugin Stats WordPress plugin screenshot
OCD Plugin Stats WordPress plugin screenshot

I’ve just published another WordPress plugin called OCD Plugin Stats.  This isn’t a plugin that would really interest most people.  If you’re a WordPress plugin developer and like seeing the stats for your plugins, OCD Plugin Stats will let you monitor all the stats for all of your plugins in one convenient location in your WordPress dashboard.

Unless you publish your own plugins, I can’t imagine anyone would be terribly interested in such a thing.  My reason for making this plugin was that (a) I found it useful, so perhaps others would too and (b) I wanted to learn how to create a WordPress dashboard widget.
Default Series Title