Overview

Hardal Analytics uses a modern data architecture built on Hardal DB with SQL for high-performance analytics. Our cookieless analytics system captures comprehensive event data while respecting user privacy. This guide outlines the complete data model and table structures used in Hardal Analytics.

Core Tables

1. Website Events Table (website_event)

The primary table that stores all user interactions and page views. This table is partitioned by month for optimal performance.

Column NameData TypeDescription
idUUIDUnique identifier for each event (auto-generated)
website_idLowCardinality(String)Unique identifier for the website/app
session_idLowCardinality(String)Unique identifier for the user session
hostnameLowCardinality(String)Domain name of the website
browserLowCardinality(String)Browser name (e.g., ‘Chrome’, ‘Safari’)
browser_versionLowCardinality(String)Browser version number
osLowCardinality(String)Operating system (e.g., ‘Windows’, ‘macOS’)
deviceLowCardinality(String)Device type (‘desktop’, ‘mobile’, ‘tablet’)
screenLowCardinality(String)Screen resolution (e.g., ‘1920x1080’)
viewport_sizeLowCardinality(String)Viewport dimensions
device_pixel_ratioFloat32Device pixel ratio for retina displays
languageLowCardinality(String)Browser language setting
countryLowCardinality(String)User’s country code (ISO 3166-1)
timezoneLowCardinality(String)User’s timezone
urlStringComplete URL of the page
url_pathStringPath component of the URL
url_queryStringQuery parameters from the URL
url_protocolLowCardinality(String)Protocol used (e.g., ‘https:‘)
url_hashStringURL hash component
referrerStringComplete referrer URL
referrer_pathStringPath component of the referrer
referrer_queryStringQuery parameters from referrer
referrer_domainStringDomain of the referring page
page_titleStringPage title from HTML
event_typeLowCardinality(String)Type of event (‘pageview’, ‘event’)
event_nameLowCardinality(String)Name of the event (e.g., ‘page_view’, ‘click’)
created_atDateTimeTimestamp when the event was created

2. Event Data Table (event_data)

Stores custom properties and additional data associated with events. This allows for flexible event tracking without schema changes.

Column NameData TypeDescription
idUUIDUnique identifier for each data entry
website_idLowCardinality(String)Website identifier
session_idLowCardinality(String)Session identifier
event_idUUIDReferences the main event in website_event
event_nameLowCardinality(String)Name of the associated event
url_pathStringPath where the event occurred
data_keyStringProperty name/key
string_valueNullable(String)String value for the property
number_valueNullable(Float64)Numeric value for the property
date_valueNullable(DateTime)Date/time value for the property
data_typeUInt32Type indicator for the stored value
created_atDateTimeTimestamp when the data was created

3. Session Data Table (session_data)

Stores session-level properties and user attributes that persist across multiple events within a session.

Column NameData TypeDescription
idUUIDUnique identifier for each session data entry
website_idLowCardinality(String)Website identifier
session_idLowCardinality(String)Session identifier
data_keyStringProperty name/key
string_valueNullable(String)String value for the property
number_valueNullable(Float64)Numeric value for the property
date_valueNullable(DateTime)Date/time value for the property
data_typeUInt32Type indicator for the stored value
created_atDateTimeTimestamp when the data was created

Table Configuration:

  • Engine: ReplacingMergeTree (handles updates to session data)
  • Ordering: (website_id, session_id, data_key)

Data Flow and Relationships

Session Management

  • Each user session is identified by a unique session_id
  • Sessions are cookieless and based on server-side fingerprinting
  • Session data persists across multiple page views and events

Event Hierarchy

website_event (main event record)
├── event_data (custom properties)
└── session_data (session-level attributes)