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!

Added Project ID as a param for hashing

Blue Moused7557478635d
diff --git a/src/analytics/analytics.controller.ts b/src/analytics/analytics.controller.ts
index 86e95ec76..413065a5b 100644
--- a/src/analytics/analytics.controller.ts
+++ b/src/analytics/analytics.controller.ts
@@ -30,7 +30,7 @@ dayjs.extend(utc)
// todo: implement random salts
// store them in redis storage and reset every 24 hours
-const getSessionKey = (ip: string, ua: string, salt: string = '') => hash(`${ua}${ip}${salt}`).toString('hex')
+const getSessionKey = (ip: string, ua: string, pid: string, salt: string = '') => hash(`${ua}${ip}${pid}${salt}`).toString('hex')
const analyticsDTO = (pid: string, ev: string, pg: string, lc: string, ref: string, sw: number | string, so: string, me: string, ca: string, lt: number | string, tz: string, unique: number): Array<string | number> => {
const cc = tz === 'NULL' ? 'NULL' : ct.getCountryForTimezone(tz)?.id
@@ -160,7 +160,7 @@ export class AnalyticsController {
const { 'user-agent': userAgent, origin } = headers
await this.analyticsService.validate(logDTO, origin)
- const sessionHash = getSessionKey(ip, userAgent)
+ const sessionHash = getSessionKey(ip, userAgent, logDTO.pid)
const unique = await this.analyticsService.isUnique(sessionHash)
let dto: Array<string | number>