App Store Rank for Many Apps

If you have more than a few apps in the App Store, keeping track of the rank of your apps can become a chore. There’s over a dozen apps in the store that I’ve developed, and for marketing (and, sure, ego) reasons I’d like to know how they are doing. But I’m busy. And laaazy. I wanted a script to do it for me.

The goal was to have a single, flexible script. And specifically, I wanted something I could call from an AppleScript, which would place the results into a spreadsheet without lots of text parsing in AppleScript (because text parsing is tedious in AppleScript, although to be fair, everything is tedious in AppleScript.)

The script I came up with is mostly Ben Chatelain’s excellent perl script (again based on the work of Erica Sadun). To better fit my workflow, I modified Ben’s script in the following ways:

  • Accepts the app ID, category, “free” or “paid”, and country name as arguments the command line.
  • Returns just a number (the app’s rank in the given category), or “n/a” if it’s not ranked in the top 100 for that category/country combination.
  • Arguments (except app ID) are optional — the script will assume “Top Overall”, “United States”, and “free”.)
  • The script will cache the most recent data (and curl is invoked with -z). This way, if you call the script a dozen times in a row, it only pulls the page once, and the rest of the invocations use the cached data (stored in /tmp).
  • To check the “Top Apps” overall rankings, pass in “Top Overall” for the category name.
  • Likewise, to see the ranking for every country in the world, pass in “world” for country. The script will check the top apps for every country. In this case, the returned results are a string of “countryName: rank\n”, one per country.

You call it from the command line like this:

app_rank.pl appID categoryName free|paid countryName
rob$ app_rank.pl 300872165 News free
37

Or to see the results for the whole world (results edited for blog brevity):

rob$ app_rank.pl 300872165 News free world
Lebanon: 47
Saudi Arabia: 73
Pakistan: 74
Mexico: 71
Colombia: 61
Hungary: 89
Croatia: 19
...et cetera...

(How is my english-language not-localized North-Carolina-specific app #19 in Croatia?!?)

Here’s the AppleScript I use to populate a spreadsheet:

AppleScript to get the app rank and put it into Numbers

AppleScript to get the app rank and put it into Numbers

Here’s the spreadsheet it fills out. The AppleScript pulls the appID to look up from the first cell in each column, and then adds the timestamp and the app’s rank, so I can add new app IDs as I get them.

App rank data in Numbers

App rank data in Numbers

I scheduled the script to run every few hours (using Ligon) and so I’m slowly accumulating data. Of course, I can never sleep my laptop or I’ll miss some data. This concept would probably be best realized as something that runs on a server via cron. Since it’s a perl script that uses curl instead of some CPAN package it’s probably easily portable to just about anywhere. It would be simple to move this script to a server and collect the data in some other fashion.

Note that you can also use this same technique to track your app’s success against competing apps.

The script is here (3k zipped perl script).



Tags: , , ,
This entry was posted on Tuesday, May 26th, 2009 at 10:57 am and is filed under Cocoa Touch, iPhone Development. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

One Response to “App Store Rank for Many Apps”

  1. Guy

    Hi,
    I can’t get the original script to work. I get the $doc, but the script does not enter into the while loop
    while ($doc =~ m#(\d+)\. rank
    # 2 => app ID
    # 3 => app name
    print “in loop:\n”;
    print $1 . ” ” . $3 . ” ” . $2 . “\n”;
    push(@top100, ($1, $2, $3));
    }
    I never get the print “in loop”, any idea what to do or how to debug it?
    Thanks

Leave a Reply

Your comment