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!

add timebucket year

Maksim Mrugf590d932af5a
diff --git a/apps/production/src/analytics/analytics.service.ts b/apps/production/src/analytics/analytics.service.ts
index 069fccf65..4b02e30af 100644
--- a/apps/production/src/analytics/analytics.service.ts
+++ b/apps/production/src/analytics/analytics.service.ts
@@ -109,6 +109,7 @@ const validTimebuckets = [
TimeBucketType.HOUR,
TimeBucketType.DAY,
TimeBucketType.MONTH,
+ TimeBucketType.YEAR,
]
// mapping of allowed timebuckets per difference between days
@@ -124,7 +125,8 @@ const timeBucketToDays = [
}, // 4 weeks
{ lt: 366, tb: [TimeBucketType.MONTH] }, // 12 months
{ lt: 732, tb: [TimeBucketType.MONTH] }, // 24 months
- { lt: 999999, tb: [TimeBucketType.MONTH] }, // more than 24 months
+ { lt: 1464, tb: [TimeBucketType.MONTH, TimeBucketType.YEAR] }, // 48 months
+ { lt: 99999, tb: [TimeBucketType.YEAR] },
]
// Smaller than 64 characters, must start with an English letter and contain only letters (a-z A-Z), numbers (0-9), underscores (_) and dots (.)
diff --git a/apps/production/src/analytics/dto/getData.dto.ts b/apps/production/src/analytics/dto/getData.dto.ts
index 53a39d5bc..26e3deabc 100644
--- a/apps/production/src/analytics/dto/getData.dto.ts
+++ b/apps/production/src/analytics/dto/getData.dto.ts
@@ -6,6 +6,7 @@ export enum TimeBucketType {
HOUR = 'hour',
DAY = 'day',
MONTH = 'month',
+ YEAR = 'year',
}
// eslint-disable-next-line @typescript-eslint/naming-convention