This R script helps you visualize when users cancel their plans for a SaaS product.
For example, here are the cancellation curves for an example SaaS product with three plans, Gold, Silver, and Bronze:
This shows is that most users who cancel do so pretty quickly and that long term about 30% of Gold plans, 20% of Silver plans, and 10% of Bronze plans cancel their subscription.
If you've never used R before, you'll need to install R and optionally download a tool like RStudio to run this script. You'll also need to install the ggplot2
package with install.packages("ggplot2")
and use setwd()
to change the working directory to match the location of this script.
In order for it to work, all you need to do is to generate a CSV file containing three columns:
- The unix timestamp when people purchased a plan
- The unix timestamp when people cancelled the plan (or blank if it hasn't been cancelled)
- The name of the plan
You should not include column headers.
Here's an example:
1451606400,1453359994,gold
1451606400,,gold
1451606400,,gold
1451606400,,silver
1451606400,,silver
1451606400,1455394199,silver
The provided data/example.csv
contains a test dataset that you can use to test the script.
You'll need to edit the file
variable at the top of cancellation-curve.r
based on the name and location of your actual data file.
Within RStudio, simply load the script using source("cancellation-curve.r")
.
If all went well, it should generate the chart above.
If you have any suggestions, find a bug, or just want to say hey drop me a note at @mhmazur on Twitter or by email at [email protected].
MIT © Automattic