📈 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!
TypeScript chartsclickhousedockergdprgoogle-analyticsmetricsmonitoringmysqlnestjsprivacyredisself-hostedselfhostedstatisticstailwindcssweb-analyticswebanalyticswebsite
Added unique param for pageviews
Blue Moused78d6eac35d9
diff --git a/src/analytics/analytics.controller.ts b/src/analytics/analytics.controller.tsindex fb113111d..6033b3a8d 100644--- a/src/analytics/analytics.controller.ts+++ b/src/analytics/analytics.controller.ts@@ -194,8 +194,10 @@ export class AnalyticsController {const br = ua.browser.nameconst os = ua.os.namedto = analyticsDTO(logDTO.pid, logDTO.pg, dv, br, os, logDTO.lc, logDTO.ref, logDTO.so, logDTO.me, logDTO.ca, logDTO.lt, logDTO.tz, 1)- } else {+ } else if (!logDTO.unique) {dto = analyticsDTO(logDTO.pid, logDTO.pg, 'NULL', 'NULL', 'NULL', 'NULL', 'NULL', 'NULL', 'NULL', 'NULL', 'NULL', 'NULL', 0)+ } else {+ throw new BadRequestException('Event was not saved because it was not unique while unique only param is provided')}// todo: fix: may be vulnerable to sql injection attackdiff --git a/src/analytics/dto/pageviews.dto.ts b/src/analytics/dto/pageviews.dto.tsindex 637f846dd..33e36bc52 100644--- a/src/analytics/dto/pageviews.dto.ts+++ b/src/analytics/dto/pageviews.dto.ts@@ -53,6 +53,12 @@ export class PageviewsDTO {})ca: string+ @ApiProperty({+ example: false,+ description: 'If true, only unique events will be saved'+ })+ unique: boolean+// Performance metrics@ApiProperty({example: 261,