Hardal Analytics Session & User ID Relationship

When analyzing a website or an application, one of the most fundamental metrics is the Session count. This article examines in detail Hardal's session calculation logic.

Ecem Bircan

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:

TimeUser ActionSession IDReason
10:00Site Entry324432_1The user's first session starts.
10:15Browsing the Page324432_1Less than 30 minutes since the last activity, the same session continues.
10:25Site Closed324432_1The 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:20Site Entry Again324432_2More 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.

Ready to switch first-party and server-side measurement?

Join hundreds of companies using Hardal for better and faster data quality.