Question

Breaking down #number of events since user signed up

  • 7 July 2020
  • 4 replies
  • 324 views

I am trying to use JQl to get a breakdown of how much our users use our feature x number of months since the first started using it.

What I’ve gotten so far:

let month = '0';
function main() {
  return Events({
    from_date: "2015-06-06",
    to_date: "2020-07-06",
  })
 .groupByUser(function(state, events) {
    state = state || {last_event : null, last_time: 0, eventsByMonth: {}};
    if(!state.fist_time && !state.first_event) {
      state.first_event = events[0].name;
      state.first_time = events[0].time;
    }
    _.each(events, function(e) {
      
      let key = Math.floor((new Date(e.time).getTime() - new Date(state.first_time).getTime() )/ (1000*60*60*24*30))
      if(!state.eventsByMonth[key])
      {
        state.eventsByMonth[key] = 0;
      }
      state.eventsByMonth[key]++;
      
      state.last_event = e.name;
      state.last_time = e.time;
    });
    return state;
  })
  .map(function(m) { 
    return  m.value.eventsByMonth
  })
  .reduce(mixpanel.reducer.numeric_percentiles(month ,
      [10, 25, 50, 75, 90, 99, 99.999]),
  )

}

My problem is I would very much like to get this list out for all the months in a single report, but i can’t figure out how to call multiple reducers on the result after the map function. 

I want a result with all the months printed out at once kind of like this:

%     0   1   2   3 ...
10    5   6    4  3 ...
25    7   8   9  2 …


But right now I can only get it printing out one month a time.

Or is there a better way to get this info? I couldn’t figure out how to do this built into any of the views mixpanel has.


4 replies

Userlevel 2
Badge +2

Hi @zachToybox 

 

Is there a reason you’re trying to do this in JQL as opposed to the Retention report?

In Retention you can choose your Event x as the first event, then spread out the timeframe to be across multiple months, break down the report by months, and then see how many users come back and do the same event over and over across multiple months.

 

If this doesn’t work, and I’ve misunderstood what you require, let me know and we can look at this again.

 

Thanks a lot,

Matt

Yeah as far as I can tell the retention report can only show us if a user retains, it gives no information about how much activity they perform only that they did it at least once. The retention report doesn’t give nearly enough information for this.


Also I want to be able to compare everyone’s 5th month, and not have it separated by starting month.


So with this I can see that our 50th percentile people perform who do this task do it 20 times in their 5th month. With the retention report all I can see is that 20% of people perform the task at least once in the 5th month.

Userlevel 2
Badge +2

Hi @zachToybox 

 

Apologies for the delay here, I was on holiday from the first week of July until today.

In your case then yes the best option would be to export the data and run the analysis offline. To do this analysis within Mixpanel you would need to use a combination of Cohorts, Insights and Retention to see what you need and even then it would be across multiple reports.

 

Your best bet is to submit this same question over in the Pulling Data Out of Mixpanel section of the Community. Here you can get a more technical response to your JQL query. If you don’t get a response you can submit a ticket directly to our support team through your project. Just hit the Help ? top right in your project and choose “Contact Support”.

 

Thanks a lot

Matt

Userlevel 5
Badge +3

@zachToybox —

I was able to move your post into the Pulling Data Out of Mixpanel section to get new eyes on your question. @glencwillis is a JQL wiz, and might be able to take a look at the JQL query that you put together to give some feedback.

 

I appreciate you sharing your perspective on what you would like to accomplish with the retention report — I’ve tagged @michael, the Retention PM so they can see your feedback!

 

Thanks for sharing your use-case!

Reply


Mixpanel