This post was inspired by Dan Croak (@croaky) over at The Giant Robots Blog. His approach to user retention is spot-on and his walk through for user retention graphs are very useful for building a consumer facing product.

I tweeted that a user retention curve is easier to explain to other people in the business in a way that is actionable.

Taking this one step further, I think that building such a curve should be mindless to generate. Dan’s tutorial was straightforward but making it automatic will decrease the time to generate the graph. Making a user retention graph a no-brainer will make it much more likely that it gets generated at a regular interval and shared with other people in the business. In particular, manually changing the colors and building a graph in Google Sheets is fairly arduous.

MOAR AUTOMATION

Dan’s (and now my) goal of producing user retention curves can be better automated. All it takes is R (or RStudio) and the downloaded csv from Mixpanel (see Dan’s post for the format of the csv).

After about an hour of playing (yes, it was super fun) in R, the process can be better automated with this gist.

The script produces the following graphs (click to zoom in):

All Data

User Retention - All

Filtered Data

User Retention - filtered

Note that X0.weeks.later isn’t that interesting for this product. So, it can be cut out by simply subsetting the data:

retention %>% filter(t != 'X0.weeks.later' & weeks_ago != 27)

The Future

The next step is to automatically pull the data into R from the Mixpanel API. It should be relatively straightforward.

This script is certainly going to be useful to me as we continue to build Cricket’s Circle. I hope it’s useful for you as you’re building whatever web or native product you’re building. Let me know what you’re working on and, as always, improvements are always welcome. Thanks Dan for the inspiration.