When analyzing a website or an application, one of the most fundamental metrics is the "Session" count.
So, how does the Hardal system determine when a session starts and when it ends?
In fact, measurement is done here with the same 30-minute sessions that everyone knows from Google Analytics 4.
In this article, we will examine in detail Hardal's session calculation logic, the technical terms used, and how this system works through an example scenario.
What is a Session?
Simply put, a session is a specific period of time during which a user interacts with your website or application.
All page transitions, clicks, and actions performed during this interaction period are collected under a single session.
Hardal’s 30-Minute Rule
Hardal Analytics uses a standard 30-minute inactivity period to separate sessions.
When a user performs any activity (page view, click, etc.) on your site, this 30-minute timer resets and starts again.
- As long as the user is active and the 30-minute inactivity period has not expired, the session continues.
- If 30 minutes have passed since the user's last activity and the user returns to the site, a new session starts.
Thanks to this rule, we can clearly distinguish between a user who closes the site and returns shortly after, and a user who closes the site and returns hours later — resulting in more accurate analysis.
Explanation with an Example Scenario
Let’s examine how this rule works in practice through a user with ID 324432:
| Time | User Action | Session ID | Reason |
|---|---|---|---|
| 10:00 | Site Entry | 324432_1 | The user's first session starts. |
| 10:15 | Browsing the Page | 324432_1 | Less than 30 minutes since the last activity, the same session continues. |
| 10:25 | Site Closed | 324432_1 | The session became inactive, the timer continues. |
| 10:55 | (30 minutes passed) | - | 30 minutes have passed since 10:25. If the user returns, a new session should start. |
| 11:20 | Site Entry Again | 324432_2 | More than 30 minutes (55 minutes) have passed since the last activity at 10:25. Therefore, a new session has started, and the counter increased by one. |
In this scenario, the same user (ID: 324432) has created two different sessions:
324432_1 and 324432_2.
Technical Depth: Session ID Structure
Session Timeout Value
In all Hardal Analytics measurements, the standard Session Timeout value is 30 minutes.
Creating a Unique Session ID
Each session gets a unique identifier by combining the user ID and that user’s session sequence number.
This allows us to easily track both historical and real-time user behavior.
The format used is:
{user_id}_{session_sequence_number}
Examples:
- A user’s first session →
324432_1 - A user’s fifth session →
324432_5
This structure allows us to perform both user-based and session-based analyses quickly and efficiently in database queries.