Hi, I could not find an answer to this question but if there is already a topic discussing this issue I apologize.
I'm trying to track how many 'active minutes' each user spends on my site and accomplish this what I currently do is:
-Query my events table for unique user count per minute. This give me a visualization that represents which users did an action on the site for every minute. This is great, but now I want to aggregate this information on a daily basis and see how many minutes each user used the site for. Is there a way to feed my current visuazliation into another to aggregate a whole day?
Here is a screenshot of my visualization with unique user events per minute. Each color represents a different user and if they are present in a certain timestamp it means they made an action in that one minute interval.
Is this question clear? Should I provide more information?
What you asked for, at least the question posed,
Is there a way to feed my current visuazliation into another to aggregate a whole day?
means you want pipeline aggregations, which is not yet supported in Kibana, see issue.
However, I think there is a way to do what you want without pipeline aggregations. But this means modifying your mappings to include a start and end time for each record. If you do this, then you can create a
scripted field where you subtract the
start time from the
end time and display the value in minutes. Now you can use a terms aggregation on the x axis for users and a sum of elapsed_time (in minutes) as a Y metric aggregation.
Another way, if you only have timestamps, would be to do a calculation between the last record and the current record.
Thanks so much for the reply, and for linking that issue. I will definitely keep an eye out for pipeline aggregations.
Unfortunately the options you suggested work quite work for me because our events will usually overlap, one user click may trigger multiple events which all start at the same time and would not want to double count.
In regards to your second suggestion, I'm not sure it would work quite the same because we are trying to track 'active minutes' so that if a user is not clicking or doing anything with the app then we don't want it to count towards their total usage.
I will look into your scripted field suggestion though and see if I can come up with something that works for now. Do you have any recommended resources for learning more on how to use scripted fields for doing this type of aggregations?