• Skip to primary navigation
  • Skip to main content
  • Skip to footer

Web Analytics Hub

Analytics for Growing Companies

  • Home
  • Blog
  • Portfolio
  • Case Studies
  • Freelancing in Data World
  • About Us
  • Contact

Cohort Analysis Example: A guide to understand user retention

October 3, 2018 By Pravin Singh 2 Comments

The customer plays an important role in every business and knowing the behavior of these customers can lead to meaningful insights for the business. One of the tools which have been long used to understand the behavior of the customer is cohort analysis. In this post, we will briefly walk through a cohort analysis example.

Let us begin by understanding what are Cohorts exactly. A cohort is simply a group of people having similar characteristics. These could either be their spending pattern or a particular date on which a group of people is on-boarded to a platform.

For example, consider any companies with large datasets like Uber or OLA, for these companies a cohort could be a group of people joining their platform on a particular day. Cohort analysis can come in handy to understand how good the business is in retaining people to their platform.

A typical data set for such analysis would be as shown below.

 

 

Cohort Analysis Example

This dataset consists of a particular order Id the date of order charges and other specifications.  The whole process of doing a cohort analysis can be broken down into the following steps.

  1. Determine the time interval of monitoring the cohort
  2. Determining the cohort group of users
  3. Prepare the data set with the cohort period
  4. Display the result

In this cohort analysis example, we will only be exploring one possibility, which is monitoring the retention of users. However, the same analysis could lead to multiple other insights such as monitoring the revenue over a period of time i.e to check the percentage of each cohorts revenue returning in subsequent periods.

Let us briefly take a look at each of these steps.

 

Table of Contents

  • Cohort analysis Example
    • 1. Determine the time interval of monitoring a cohort
    • 2. Determine the cohort group of Users
    • 3. Prepare the dataset with the cohort period
    • 4. Display the result
  • Summary:

Cohort analysis Example

 

1. Determine the time interval of monitoring a cohort

The cohort data in our cohort analysis example is of a particular food delivery store. Thus, in this case, let us monitor the cohort on a monthly basis. Using the data given above we create a period column (OrderPeriod). The data looks as follows after the first manipulation

 

Cohort Analysis Example

2. Determine the cohort group of Users

 

The cohort, in this case, would be the number of users ordered in particular date. Determining it is very simple. All you have to do is a group by with the Orderdate and keep the year and the Month alone in the data. After such a transformation we have the following data.

 

Cohort Analysis Example

3. Prepare the dataset with the cohort period

 

Now, all we have to do is to present the data in the required format before we can have insights into the same. The little mashups that we have to do to the data are as follows:

  1. Aggregate Users, Orders and amount spent by cohort group within one month.
  2. Label the cohort period.

This done the data will look something like this.

 

Cohort Analysis Example

4. Display the result

 

Hang in there, we are almost there!

Now to see the user retention pattern we need to unstack the values of total users and plot the heat map of the resulting table. This will enable us to track the retention of users over a period of time.

Now that all the manipulations have been performed let us look at the resulting visualization and gain some insights.

 

Cohort Analysis Example

The first thing that we can observe is that fewer users tend to purchase as time goes on.

The longest cohort is the cohort started on 2009-01 which stayed through fifteen months.

Some points to observe are we see sudden surges in an increase in the number of people in certain months for cohorts. A thorough investigation is needed in these cases to look at the reason for these surges. This may give insights on certain marketing activities that got more users to visit or other reasons.

These and multiple more visualizations can be made using various dashboard and reporting tools

 

Summary:

 

So far in this post, we have seen the steps taken to perform cohort analysis and the insights we can derive from them. We have only seen the retention of the users in this example.

Following are some of the areas where immediate insights can be drawn from cohort analysis

  • Check if the new marketing campaign is generating customers: The essential part of every marketing campaign is to generate customers. One easy way to monitor if the campaign is converting leads to customers is to use cohort analysis. Here apart from looking at the date of order as in our example we should use the campaign column (if exists) along with it. To track the customers generated from a particular campaign over a period of time
  • Seeing the sources that are driving more results: In this digital age, it is but common that multiple channels are used to market, and it is absolutely not necessary that all the channels generate an equal number of users. To check which channel not only generates but also retains users cohort analysis can be used and independent cohort graphs can be observed to generate the most customer generating channel.
  • Decoding the purchase habits of customers: Often it is observed that all the customers are not from the same region or with the same frequency or volume of purchases. Also, they need not be of the same gender or belong to the same age group. So grouping customers by country in this case and measuring the total revenue for a particular country you can observe the purchase habits and learn the lifetime value of customers.

References:

1. You can find the data and code used to do this exercise here

2. A definitive guide to effective cohort analysis

Feel free to drop your questions and thoughts in the comments and we would be happy to help you out.

 

Filed Under: Data Analysis Tagged With: analysis, cohort analysis, data visualization

Reader Interactions

Comments

  1. Cigin says

    July 9, 2019 at 6:45 pm

    I believe you should definitely mention this article in your reference : http://www.gregreda.com/2015/08/23/cohort-analysis-with-python/.
    Instead of the github link you have mentioned in your reference.

    Thanks, Cigin

    Reply
    • Pravin Singh says

      August 10, 2019 at 11:55 am

      Good resource, thanks for sharing!

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Footer

Featured Posts

Crypto Market Intelligence: 3 Powerful Onchain Data Growth Strategies

December 26, 2024 By Pravin Singh Leave a Comment

Welcome to the new frontier of crypto market intelligence, where every transaction tells a story and every wallet leaves a trail. Within decentralized finance (DeFi), the traditional black box of competitor analysis has transformed into the transparent glass house of blockchain data. Through advanced crypto market intelligence, we can now watch competitors’ customers move between […]

Marketing Attribution: Data-driven Journey at a Hyper-Growth Startup

July 1, 2024 By Pravin Singh Leave a Comment

Marketing attribution: two words that can send shivers down the spine of even the most seasoned marketers. Marketing attribution is like a detective game. It’s about figuring out which marketing moves really helped your startup grow. You have to get many things right to make it work. The people who care most about this are […]

From Zero to Data Powerhouse: Building a Modern Data Stack for Startups

May 26, 2023 By Pravin Singh 1 Comment

In the midst of exploring diverse career opportunities in the realms of freelancing, e-commerce, marketplace analytics, on-chain analytics and crypto consulting an intriguing prospect came my way. It was an exceptional challenge and a rare opportunity – a chance to be the first data team member of a promising fintech product. Having spent the past […]

Copyright © 2026 · webanalyticshub.com