Funnel analysis using MongoDB?

I have a collection called "event", it tracks the event from mobile applications. Event Document Structure

{
  eventName:"eventA",
  screenName:"HomeScreen",
  timeStamp: NumberLong("135698658"),
  tracInfo:
       {
         ...,
         "userId":"user1",
         "sessionId":"123cdasd2123",
         ...
       }
}

I want to create a report to display a specific sequence:

for example: funnel: event1 → event2 → event3 I want to find the score:

  • event1
  • event1 then event2
  • event1, then event2, and then event3

and the session is also considered to have occurred in one session. Note: I just want to be clear, I want to create any funnel that I define, and be able to create a report for it.

Thank..

+4
source share
1 answer

, , :

db.event.aggregate([
    { $group: { _id: '$tracInfo.sessionId', events: { $push: '$eventName' } } }
])

sessionId eventNames. $group. , , , . 2.6 $out operator.

+2

Source: https://habr.com/ru/post/1538349/


All Articles