This tool was created to perform Cohort Analysis and calculate Retention Rates based on PayPal logs. It is made to accompany a post I wrote for the Toptal Engineering Blog--I recommend you check out the article!
If you have any questions, you can contact me at alejandro@postcron.com. I hope you find it useful!
-
Install the code on your server (just unzip or clone the files in a subfolder (see the comments below)).
-
Download your PayPal logs (see the instructions/comments below).
-
Run the code and upload said PayPal logs.
-
View, as output: a) Your short-term retention rate. b) Your long-term retention rate. c) A graph displaying Cohort Analysis of your PayPal sales.
Some people calculate retention by comparing the number of users at a given month relative to the first month that these users joined the service; I prefer to calculate retention rates based on the previous month.
For instance, an 80% retention rate means that 80% of the customers that were present on the previous month are still present.
Short-term retention rates are related to the retention during the first month.
Long-term retention rates ignore the first month retention (usually, long-term retention is higher than short-term retention).
Again, I recommend that you read the article on the Toptal Engineering Blog.
-
Clone the files in a subfolder.
-
Make sure that the "Upload" directory has enough permissions to allow file uploading. Uploaded logs will reside there temporarily.
-
Make sure the size file you are trying to upload is below the maximum allowed size by PHP.
To view or modify this limit check your php.ini file:
; Maximum allowed size for uploaded files. upload_max_filesize = 5M
-
Clone the files in a subfolder.
-
Place your .csv PayPal log in the "Upload" directory.
-
Type: 'php parse.php [filename.csv]' (e.g., 'php parse.php mylog.csv').
-
Note that the ordering of results is as follows: {1} - cohort analysis, {2} - short-term retention rate, {3} - long-term retention rate.
-
Login to PayPal.
-
Click on History -> Download History.
-
On the resulting page, select the date range of the transactions you want to download.
-
Make sure to select "Comma Delimited, All Activity" as 'File Type'.
-
Make sure to check the "Include Shopping Cart Details" option.
-
Click on 'Download History'.
-
PayPal will start generating the CSV file. Once the file is ready, you will receive a notification via email. Wait for the notification email.
-
Come back to History -> Download History.
-
Come to "Download Recent History Logs" page.
-
Select the log file.
-
Click on "Download Log".
-
A CSV file will be downloaded.