Visitors and Session Duration
Today I'll try and fix what was missing yesterday.
There definitely aren't 0 visitors, so there's something wrong with the userIds.
I forgot to add the field to the backend 🤦♂️
Moving on, I need to tackle the session duration.
With the current data, I can take the time from the last action of a session and subtract it from the first action of a session. This does not account for the time spent with no actions. I'll check if there's a way to tell when a user leaves.
Turns out there's an event handler just for that - beforeunload
. However, I can't really implement that yet without making changes to the data, so I'll leave that for another time. In the meantime, here's the not-exactly-precise session duration!
At this stage I'm just trying to get something done. I'm not exactly too concerned about the data being 100% correct, because I don't completely understand the requirements yet. Once everything is crystalized, I will write tests for all of these queries to be absolutely sure they are 100% correct.
Next steps will be:
- Visualizing different metrics
- Displaying trend indicators
- Range selector
- Website selector
- Visual touches