Refactor analytics data structure to replace 'iso_3166_2' with 'region' (#92)

* Refactor analytics data structure to replace 'iso_3166_2' with 'region'

- Updated multiple files across the client and server to change references from 'iso_3166_2' to 'region' for consistency in data handling.
- Adjusted type definitions, API responses, and SQL queries to reflect the new naming convention.
- Enhanced filter parameters and UI components to ensure seamless integration of the updated region data.

* Refactor Clickhouse session table and materialized view creation

- Updated the Clickhouse integration to create a streamlined sessions table with essential fields for session tracking.
- Introduced a materialized view for aggregating session data from events, ensuring accurate session start and end times, along with user and pageview information.
- Removed commented-out code for clarity and improved maintainability.
This commit is contained in:
Bill Yang 2025-04-17 22:48:19 -07:00 committed by GitHub
parent da1903910f
commit a915489fda
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 105 additions and 168 deletions

View file

@ -96,8 +96,7 @@ class PageviewQueue {
screen_height: pv.screenHeight || 0,
device_type: getDeviceType(pv.screenWidth, pv.screenHeight, pv.ua),
country: countryCode,
iso_3166_2:
countryCode && regionCode ? countryCode + "-" + regionCode : "",
region: countryCode && regionCode ? countryCode + "-" + regionCode : "",
city: city || "",
lat: latitude || 0,
lon: longitude || 0,