Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

smaller online users window

Blue Mouse572d23503992
diff --git a/backend/apps/cloud/src/analytics/analytics.controller.ts b/backend/apps/cloud/src/analytics/analytics.controller.ts
index dd9ad13fe..d97b8b86e 100644
--- a/backend/apps/cloud/src/analytics/analytics.controller.ts
+++ b/backend/apps/cloud/src/analytics/analytics.controller.ts
@@ -105,6 +105,8 @@ const DEFAULT_MEASURE = 'median'
// https://github.com/Swetrix/swetrix/issues/371
const BOT_RESPONSE = { message: 'Bot traffic detected, request is ignored' }
+const ONLINE_VISITORS_WINDOW_MINUTES = 5 // minutes
+
// Performance object validator: none of the values cannot be bigger than 1000 * 60 * 5 (5 minutes) and are >= 0
const MAX_PERFORMANCE_VALUE = 1000 * 60 * 5
const isPerformanceValid = (perf: any) => {
@@ -1083,7 +1085,7 @@ export class AnalyticsController {
const thirtyMinutesAgo = dayjs
.utc()
- .subtract(30, 'minute')
+ .subtract(ONLINE_VISITORS_WINDOW_MINUTES, 'minute')
.format('YYYY-MM-DD HH:mm:ss')
// Query ClickHouse for active sessions in the last 30 minutes
diff --git a/backend/apps/community/src/analytics/analytics.controller.ts b/backend/apps/community/src/analytics/analytics.controller.ts
index 29f4f99e6..4d63136c6 100644
--- a/backend/apps/community/src/analytics/analytics.controller.ts
+++ b/backend/apps/community/src/analytics/analytics.controller.ts
@@ -89,6 +89,8 @@ const DEFAULT_MEASURE = 'median'
// https://github.com/Swetrix/swetrix/issues/371
const BOT_RESPONSE = { message: 'Bot traffic detected, opinion rejected :D' }
+const ONLINE_VISITORS_WINDOW_MINUTES = 5 // minutes
+
// Performance object validator: none of the values cannot be bigger than 1000 * 60 * 5 (5 minutes) and are >= 0
const MAX_PERFORMANCE_VALUE = 1000 * 60 * 5
const isPerformanceValid = (perf: any) => {
@@ -813,7 +815,7 @@ export class AnalyticsController {
const thirtyMinutesAgo = dayjs
.utc()
- .subtract(30, 'minute')
+ .subtract(ONLINE_VISITORS_WINDOW_MINUTES, 'minute')
.format('YYYY-MM-DD HH:mm:ss')
// Query ClickHouse for active sessions in the last 30 minutes
diff --git a/backend/blog-posts b/backend/blog-posts
index 19ae59dcc..e645273db 160000
--- a/backend/blog-posts
+++ b/backend/blog-posts
@@ -1 +1 @@
-Subproject commit 19ae59dcc8225d60931549c80ba28e81f0106f37
+Subproject commit e645273dbab360cdb4d759dfe145cffcdfbf6f6b