Sunday, May 3, 2009

Application sales statistics from the CLI



The problem

Apple provides us, developers, with sales data which nicely details which of our applications have sold when and to whom. This data comes in the form of gzipped plain text files that use a CSV-like format (in fact, tab-delimited) of encoding data fields.

That's not exactly very human-readable. And while Apple provides a quick and simple "preview" button for these reports, it's hardly useful either. What we'd like to see is some statistics on how many applications we've sold in total, to whom, in what currencies, what countries and most importantly, how much profit it's made us!

Sadly, Apple does not provide, but they do give us what we need to roll our own solution. And many have. There are applications all around that parse these reports Apple gives us and render them in graphs or dump them in tables. Unfortunately, almost all of these are made by developers that like to charge. I haven't come across anything noteworthy that's freeware.



The solution

How would I solve this problem? Easy enough, I'm a developer; I might as well roll up my sleeves and get started myself. And I did.

I decided that what I wanted was something simple and fast. I didn't need the charts, all I wanted was to know how much I'd sold since the last time I checked and what my profit meter looked like so far. I'm a CLI-guy, so I wanted a way of running something from the CLI and immediately getting all the feedback I'm interested in.

Enter: iphone-stats

So I opened my vim and got to it. The result is a series of bash scripts that do everything I'm interested in for the moment. They parse my sales data (which is daily sales reports nicely organized in subdirectories named after their month) and write out some statistics on my terminal. Moreover, scripts are also provided that fetch iTunes App Store reviews on my applications and fetch my daily iTunes Connect reports for me through a cron job.

Here's what the first script, stats, looks like:


A second script, reviews, downloads customer reviews from the iTunes App Stores world-wide. This is a great way of keeping track what people are saying about your applications.

Here's what that looks like:


A third script, fetchdailies is a script that checks which the last daily report that you have is and downloads any available dailies past that. You can run it quickly from the CLI, like the other scripts, and it'll tell you what it's doing, or you can schedule it in a cron job so that it'll automatically download your available dailies for you every day.

The last script uses a python script called appdailysales, which is not mine, but is an open-source script written mostly by Kirby Turner. I've adapted it for security (of passing the password) and integration (with iphone-stats). You can, of course, invoke it directly. It has good help output if you start it with the -h argument:




Availability

The whole bundle of scripts is available from the (quick and dirty) iphone-stats homepage at:


I recommend you go through the README file contained within: It details the use very well and in great detail. Of course, you can also contact me directly if you have any issues.

0 comments: