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!

fixed avgSdur calculation

Blue Mouse211fb9f32be0
diff --git a/src/analytics/analytics.service.ts b/src/analytics/analytics.service.ts
index aeb77d881..a45c36238 100644
--- a/src/analytics/analytics.service.ts
+++ b/src/analytics/analytics.service.ts
@@ -614,7 +614,7 @@ export class AnalyticsService {
// Average session duration calculation
let avgSdur = 0
if (!customEVFilterApplied) {
- const avgSdurQuery = `SELECT avg(sdur) ${subQuery} AND sdur IS NOT NULL`
+ const avgSdurQuery = `SELECT avg(sdur) ${subQuery} AND sdur IS NOT NULL AND unique='1'`
const avgSdurObject = await clickhouse
.query(avgSdurQuery, paramsData)
.toPromise()