We are moving to Discord!

Join us on the Countly Community Discord Server! Engage in discussions, share your feature ideas, and learn from fellow Countly users to build exceptional apps and experiences.

Analytics Enterprise Version - Link user sessions to page views

Dear Countly,

I am working on the analytics part of countly, after all the data is pushed to the API.
I would like to link a session made by an user to the corresponding page views he made during this session. How can I do that ?
Also, I would like to link a session to the corresponding events that happened during this session. How can I do that ?
Thank you in advance,


  • Official comment

    Hello Leopoldo!

    Thank you for reaching out to us.

    I'm sorry it took me some time to get back to you. We have some experimental stuff that you can try for this purpose. We added a new field to all events (including views) named lsid or last session id
    and it points to _id field of session document in drill and it looks something like this:

    "lsid": "bdcedbd3865a4f485e72f4b0d895f9febd396d311629064297_gM_1629064297000",

    This is available from Countly EE v20.11.1, but we don't use it yet and are only playing with it to see what we can do with it, etc. So it is not fully tested and may be not 100% correct, but from what we tried internally it works just fine.

    So basically all views that have

    "lsid": "bdcedbd3865a4f485e72f4b0d895f9febd396d311629064297_gM_1629064297000",

    will belong to the session which has

    "_id": "bdcedbd3865a4f485e72f4b0d895f9febd396d311629064297_gM_1629064297000",

    I hope this answers your question. iI you have further questions, please let me know.

    Thank you!

    Comment actions Permalink
  • Hi Arruran,

    You can go to Users > User Profiles > Select a user profile > Select a session

    Under Event Timeline, in the drop-down you can select Custom Events or Views to get the corresponding events or views for the selected session.

    Thank you and have a nice day!


    Comment actions Permalink
  • Thanks a lot for your reply !


    How in the database schema, I can link these views with the corresponding sessions ?

    I can access to the session using CLY_SESSION and join with the corresponding user (app_user) using the uid field.

    1 - How can I access to all the views made by different users ? Is it CLY_VIEW ?

    2 -  How can link these views with the corresponding sessions ?


    Thank you in advance



    Comment actions Permalink
  • Hi Arruran,

    Below are the answers to your questions:

    1. yes, [CLY]_view is the key for internal view event
    2. Only by timestamp, so [CLY]_session is start of the session and all views that follow it, before next session start belong to that session

    Let me know if you need further help. Thank you.

    Comment actions Permalink
  • Hi Subodh,

    We've come across the same use case as Arrunan, where we want to join both the [CLY]_view and [CLY]_session tables. 

    With the current data model, there's no straightforward way to join these two essential tables. By uid it will result in a many to many relationship which will not tell us to which session corresponds each view. 

    Has there been any improvements to the data architecture of these tables since this question in April 2020?

    Can you help us out on how to join these two tables, making the relationship one (session) to many (views)?

    Thanks and looking forward to your response,


    Comment actions Permalink

Please sign in to leave a comment.