📈 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
Minor fixes
Blue Mouse77fc697faf79
diff --git a/backend/apps/cloud/src/analytics/analytics.controller.ts b/backend/apps/cloud/src/analytics/analytics.controller.tsindex 23265676a..f038c6cda 100644--- a/backend/apps/cloud/src/analytics/analytics.controller.ts+++ b/backend/apps/cloud/src/analytics/analytics.controller.ts@@ -421,12 +421,12 @@ export class AnalyticsController {let diffif (period === 'all') {- const res = await this.analyticsService.calculateTimeBucketForAllTime(- pid,- 'analytics',- )+ const [analyticsRes, customEVRes] = await Promise.all([+ this.analyticsService.calculateTimeBucketForAllTime(pid, 'analytics'),+ this.analyticsService.calculateTimeBucketForAllTime(pid, 'customEV'),+ ])- diff = res.diff+ diff = Math.max(analyticsRes.diff, customEVRes.diff)}const safeTimezone = this.analyticsService.getSafeTimezone(timezone)@@ -499,6 +499,14 @@ export class AnalyticsController {step,} = data+ await this.analyticsService.checkProjectAccess(+ pid,+ uid,+ headers['x-password'],+ )++ await this.analyticsService.checkBillingAccess(pid)+const pagesArr = await this.analyticsService.getPagesArray(pages,funnelId,@@ -506,17 +514,9 @@ export class AnalyticsController {)if (step > pagesArr.length) {- throw new BadRequestException(- `Step ${step} exceeds the number of funnel steps (${pagesArr.length})`,- )+ throw new BadRequestException('Step exceeds the number of funnel steps')}- await this.analyticsService.checkProjectAccess(- pid,- uid,- headers['x-password'],- )-const take = this.analyticsService.getSafeNumber(data.take, 30)const skip = this.analyticsService.getSafeNumber(data.skip, 0)@@ -534,12 +534,12 @@ export class AnalyticsController {let diffif (period === 'all') {- const res = await this.analyticsService.calculateTimeBucketForAllTime(- pid,- 'analytics',- )+ const [analyticsRes, customEVRes] = await Promise.all([+ this.analyticsService.calculateTimeBucketForAllTime(pid, 'analytics'),+ this.analyticsService.calculateTimeBucketForAllTime(pid, 'customEV'),+ ])- diff = res.diff+ diff = Math.max(analyticsRes.diff, customEVRes.diff)}const safeTimezone = this.analyticsService.getSafeTimezone(timezone)diff --git a/backend/apps/community/src/analytics/analytics.controller.ts b/backend/apps/community/src/analytics/analytics.controller.tsindex c55a93071..adbc715e2 100644--- a/backend/apps/community/src/analytics/analytics.controller.ts+++ b/backend/apps/community/src/analytics/analytics.controller.ts@@ -409,12 +409,12 @@ export class AnalyticsController {let diffif (period === 'all') {- const res = await this.analyticsService.calculateTimeBucketForAllTime(- pid,- 'analytics',- )+ const [analyticsRes, customEVRes] = await Promise.all([+ this.analyticsService.calculateTimeBucketForAllTime(pid, 'analytics'),+ this.analyticsService.calculateTimeBucketForAllTime(pid, 'customEV'),+ ])- diff = res.diff+ diff = Math.max(analyticsRes.diff, customEVRes.diff)}const safeTimezone = this.analyticsService.getSafeTimezone(timezone)@@ -487,6 +487,12 @@ export class AnalyticsController {step,} = data+ await this.analyticsService.checkProjectAccess(+ pid,+ uid,+ headers['x-password'],+ )+const pagesArr = await this.analyticsService.getPagesArray(pages,funnelId,@@ -494,17 +500,9 @@ export class AnalyticsController {)if (step > pagesArr.length) {- throw new BadRequestException(- `Step ${step} exceeds the number of funnel steps (${pagesArr.length})`,- )+ throw new BadRequestException('Step exceeds the number of funnel steps')}- await this.analyticsService.checkProjectAccess(- pid,- uid,- headers['x-password'],- )-const take = this.analyticsService.getSafeNumber(data.take, 30)const skip = this.analyticsService.getSafeNumber(data.skip, 0)@@ -522,12 +520,12 @@ export class AnalyticsController {let diffif (period === 'all') {- const res = await this.analyticsService.calculateTimeBucketForAllTime(- pid,- 'analytics',- )+ const [analyticsRes, customEVRes] = await Promise.all([+ this.analyticsService.calculateTimeBucketForAllTime(pid, 'analytics'),+ this.analyticsService.calculateTimeBucketForAllTime(pid, 'customEV'),+ ])- diff = res.diff+ diff = Math.max(analyticsRes.diff, customEVRes.diff)}const safeTimezone = this.analyticsService.getSafeTimezone(timezone)diff --git a/web/app/api/api.server.ts b/web/app/api/api.server.tsindex a7f974d83..8e0e01630 100644--- a/web/app/api/api.server.ts+++ b/web/app/api/api.server.ts@@ -1008,12 +1008,16 @@ export async function getFunnelSessionsServer(password?: string},): Promise<ServerFetchResult<FunnelSessionsResponse>> {+ const step = Math.max(1, Math.floor(Number(params.step) || 1))+ const take = Math.min(150, Math.max(1, Math.floor(Number(params.take) || 30)))+ const skip = Math.max(0, Math.floor(Number(params.skip) || 0))+const queryParams = new URLSearchParams()queryParams.append('pid', pid)queryParams.append('period', params.period)- queryParams.append('step', String(params.step))- queryParams.append('take', String(params.take || 30))- queryParams.append('skip', String(params.skip || 0))+ queryParams.append('step', String(step))+ queryParams.append('take', String(take))+ queryParams.append('skip', String(skip))if (params.funnelId) queryParams.append('funnelId', params.funnelId)if (params.from) queryParams.append('from', params.from)if (params.to) queryParams.append('to', params.to)