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!

fix: use proper filter types

Blue Mouse066f7056a1a4
diff --git a/backend/apps/cloud/src/analytics/analytics.controller.ts b/backend/apps/cloud/src/analytics/analytics.controller.ts
index 32094f77a..85200675c 100644
--- a/backend/apps/cloud/src/analytics/analytics.controller.ts
+++ b/backend/apps/cloud/src/analytics/analytics.controller.ts
@@ -1684,13 +1684,16 @@ export class AnalyticsController {
'GET /analytics/sessions',
)
+ const [filtersQuery, filtersParams, appliedFilters, customEVFilterApplied] =
+ this.analyticsService.getFiltersQuery(filters, DataType.ANALYTICS)
+
let timeBucket
let diff
if (period === 'all') {
const res = await this.analyticsService.calculateTimeBucketForAllTime(
pid,
- 'analytics',
+ customEVFilterApplied ? 'customEV' : 'analytics',
)
timeBucket = res.timeBucket[0]
@@ -1699,9 +1702,6 @@ export class AnalyticsController {
timeBucket = getLowestPossibleTimeBucket(period, from, to)
}
- const [filtersQuery, filtersParams, appliedFilters, customEVFilterApplied] =
- this.analyticsService.getFiltersQuery(filters, DataType.ANALYTICS)
-
const safeTimezone = this.analyticsService.getSafeTimezone(timezone)
const { groupFromUTC, groupToUTC } = this.analyticsService.getGroupFromTo(
from,
diff --git a/backend/apps/community/src/analytics/analytics.controller.ts b/backend/apps/community/src/analytics/analytics.controller.ts
index 4015b375c..fddee385e 100644
--- a/backend/apps/community/src/analytics/analytics.controller.ts
+++ b/backend/apps/community/src/analytics/analytics.controller.ts
@@ -1377,13 +1377,16 @@ export class AnalyticsController {
'GET /analytics/sessions',
)
+ const [filtersQuery, filtersParams, appliedFilters, customEVFilterApplied] =
+ this.analyticsService.getFiltersQuery(filters, DataType.ANALYTICS)
+
let timeBucket
let diff
if (period === 'all') {
const res = await this.analyticsService.calculateTimeBucketForAllTime(
pid,
- 'analytics',
+ customEVFilterApplied ? 'customEV' : 'analytics',
)
timeBucket = res.timeBucket[0]
@@ -1392,9 +1395,6 @@ export class AnalyticsController {
timeBucket = getLowestPossibleTimeBucket(period, from, to)
}
- const [filtersQuery, filtersParams, appliedFilters, customEVFilterApplied] =
- this.analyticsService.getFiltersQuery(filters, DataType.ANALYTICS)
-
const safeTimezone = this.analyticsService.getSafeTimezone(timezone)
const { groupFromUTC, groupToUTC } = this.analyticsService.getGroupFromTo(
from,