I'm storing my own copy of Google Analytics session data and I'm trying to figure out their schema.
I'm trying to figure out why does Google Analytics end sessions at midnight?
Midnight is the logic time to end a session - if there has to be a specific time at which each and every session, no matter how long it is open has to be ended.
Even if it might seem stupid to count two sessions for a user visiting from 11:55pm - and leaving after 10 minutes. You might want to count visits per day/week/month/year. An in this case there has to be some kond of delimiter. As each day/week/month/year ends/begins at midnight, this is the right time to end one session amn start a new one.
Instead of the 10 minutes example, take a 10 hours session. Wouldn't you want to have a 5 hours session on, let's say march 31 and 1st of april, instead of 10 hours on the march 31?
From Google Analytics Help : How a session is defined in Analytics https://support.google.com/analytics/answer/2731565?hl=en
End of day expiry
Bob opens your website at 11:50 PM on the 14th of August and leaves your website at 12:10 AM on the 15th of August.
The first session ends at 11:59:59 PM on the 14th of August, and the second session begins at 12:00 AM on the 15th of August.
End of day is determined by your view timezone settings.