Question

Tools like Mixpanel, KISSmetrics and others support cohort analysis out of the box but I've heard that you can do this with a bit of effort in Google Analytics as well. How do you set this up if you want to track, say, the daily and weekly retention of your visitors?

Was it helpful?

Solution

Google Analytics can do a lot but retention analysis is one of it's weak points. Since it tends to focus on visits (as opposed to visitors) you'll need to configure the cookie tracking yourself using Google Analytic's custom variables. Having said that, it's not too hard to get a simple solution running quickly.

  1. First, decide how to layout the data in Google Analytic's custom variables based on your requirements. For example, are you storing retention dates for daily, weekly or monthly tracking? Do you also want to track cohort goals? Partition this data into the available custom variable slots.
  2. Write the cohort data to these custom variables when visitors arrive or achieve goals using Google Analytic's _setCustomVar function. Setting the fourth parameter of that function to 1 indicates you want to do visitor-level (cookie) tracking.
  3. For each cohort you wish to analyze, create an advanced segment in Google Analytics. Using a regex expression in the condition will give you the flexibility to segment for interesting cohorts. ex: "All users whose first visit was the week before Christmas".
  4. Analyze the results with reports by specifying a date range and the corresponding cohort-sliced advanced segments. Another option is to extract the data using the Google Analytics Data Feed Query Explorer or their API.

Once you've put in the work your new visitors will be stamped by their first visit date and nicely fall into each daily or weekly retention bucket. If you need more detail there's a full walk through on my blog: How to do Cohort Analysis in Google Analytics.

OTHER TIPS

This really interested me so I did a little research and basically you have to customize the GA javascript in the pages to upload custom variables into google.

Once you have done that you need to go to "Advance Segments in Google Analytics" and select your custom variables. Here is a detailed description on how to accomplish this:

Hacking a Cohort Analysis with Google Analytics

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top