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!

Remove legacy user flow

Blue Mouse83693fb51a43
diff --git a/backend/apps/cloud/src/analytics/analytics.controller.ts b/backend/apps/cloud/src/analytics/analytics.controller.ts
index fe7f6d6df..76f237689 100644
--- a/backend/apps/cloud/src/analytics/analytics.controller.ts
+++ b/backend/apps/cloud/src/analytics/analytics.controller.ts
@@ -53,7 +53,6 @@ import { EventsDto } from './dto/events.dto'
import { GetDataDto, ChartRenderMode, TimeBucketType } from './dto/getData.dto'
import { GetCustomEventMetadata } from './dto/get-custom-event-meta.dto'
import { GetPagePropertyMetaDto } from './dto/get-page-property-meta.dto'
-import { GetUserFlowDto } from './dto/getUserFlow.dto'
import { GetJourneysDto } from './dto/get-journeys.dto'
import { GetJourneySessionsDto } from './dto/get-journey-sessions.dto'
import { GetFunnelsDto } from './dto/getFunnels.dto'
@@ -77,13 +76,7 @@ import {
DataDeletionPreviewDto,
} from './dto/data-deletion.dto'
import { GetVersionFiltersDto } from './dto/get-version-filters.dto'
-import {
- IFunnel,
- IGetFunnel,
- IPageProperty,
- IUserFlow,
- PerfMeasure,
-} from './interfaces'
+import { IFunnel, IGetFunnel, IPageProperty, PerfMeasure } from './interfaces'
import { GetSessionsDto } from './dto/get-sessions.dto'
import { GetSessionDto } from './dto/get-session.dto'
import {
@@ -1023,59 +1016,6 @@ export class AnalyticsController {
return this.getData(data, uid, {}, true)
}
- @Get('user-flow')
- @Auth(true, true)
- async getUserFlow(
- @Query() data: GetUserFlowDto,
- @CurrentUserId() uid: string,
- @Headers() headers: { 'x-password'?: string },
- ): Promise<IUserFlow | { appliedFilters: any[] }> {
- const { pid, period, from, to, timezone = DEFAULT_TIMEZONE, filters } = data
-
- await this.analyticsService.checkProjectAccess(
- pid,
- uid,
- headers['x-password'],
- )
-
- await this.analyticsService.checkBillingAccess(pid)
-
- this.logger.log(
- `pid: ${pid}, period: ${period}`,
- 'GET /analytics/user-flow',
- )
-
- let diff
-
- if (period === 'all') {
- const res = await this.analyticsService.calculateTimeBucketForAllTime(
- pid,
- 'pageview',
- )
-
- diff = res.diff
- }
-
- const safeTimezone = this.analyticsService.getSafeTimezone(timezone)
- const { groupFrom, groupTo } = this.analyticsService.getGroupFromTo(
- from,
- to,
- null,
- period,
- safeTimezone,
- diff,
- )
-
- const [filtersQuery, filtersParams, appliedFilters] =
- this.analyticsService.getFiltersQuery(filters, DataType.ANALYTICS, true)
-
- const params = { pid, groupFrom, groupTo, ...filtersParams }
-
- const flow = await this.analyticsService.getUserFlow(params, filtersQuery)
-
- return { ...flow, appliedFilters }
- }
-
@Get('journeys')
@Auth(true, true)
async getJourneys(
diff --git a/backend/apps/cloud/src/analytics/analytics.service.ts b/backend/apps/cloud/src/analytics/analytics.service.ts
index 7488de666..eb748644c 100644
--- a/backend/apps/cloud/src/analytics/analytics.service.ts
+++ b/backend/apps/cloud/src/analytics/analytics.service.ts
@@ -94,12 +94,8 @@ import {
TrafficCHResponse,
IGetGroupFromTo,
GetFiltersQuery,
- IUserFlowNode,
- IUserFlowLink,
- IUserFlow,
IJourney,
IJourneys,
- IBuildUserFlow,
IExtractChartData,
IGenerateXAxis,
IAggregatedMetadata,
@@ -1144,100 +1140,6 @@ export class AnalyticsService {
}
}
- removeCyclicDependencies(links: IUserFlowLink[]): IUserFlowLink[] {
- const visited = new Set<string>()
-
- return links.filter((link) => {
- const key = `${link.source}_${link.target}`
- if (visited.has(key)) {
- return false
- }
- visited.add(key)
- return true
- })
- }
-
- buildUserFlow(links: IUserFlowLink[]): IBuildUserFlow {
- const nodes: IUserFlowNode[] = Array.from(
- new Set(
- links
- .map((link: IUserFlowLink) => link.source)
- .concat(links.map((link: IUserFlowLink) => link.target)),
- ),
- ).map((node: any) => ({ id: node }))
-
- return { nodes, links }
- }
-
- async getUserFlow(
- params: Record<string, unknown>,
- filtersQuery: string,
- ): Promise<IUserFlow> {
- const query = `
- WITH page_sequences AS (
- SELECT
- psid,
- pg,
- created,
- lagInFrame(pg) OVER (PARTITION BY psid ORDER BY created) AS prev_page
- FROM events
- WHERE
- pid = {pid:FixedString(12)}
- AND type = 'pageview'
- AND created BETWEEN {groupFrom:String} AND {groupTo:String}
- AND pg IS NOT NULL
- ${filtersQuery}
- )
- SELECT
- prev_page AS source,
- pg AS target,
- count() AS value
- FROM page_sequences
- WHERE prev_page IS NOT NULL
- AND prev_page != pg
- GROUP BY
- source,
- target
- ORDER BY value DESC
- `
-
- const { data } = await clickhouse
- .query({
- query,
- query_params: params,
- })
- .then((res) => res.json<IUserFlowLink>())
-
- if (_isEmpty(data)) {
- const empty = { nodes: [], links: [] }
- return {
- ascending: empty,
- descending: empty,
- }
- }
-
- const ascendingLinks: IUserFlowLink[] = []
- const descendingLinks: IUserFlowLink[] = []
-
- this.removeCyclicDependencies(data).forEach((row: any) => {
- const link: IUserFlowLink = {
- source: row.source,
- target: row.target,
- value: row.value,
- }
- if (link.source < link.target) {
- ascendingLinks.push(link)
- } else {
- descendingLinks.push(link)
- }
- })
-
- return {
- ascending: this.buildUserFlow(ascendingLinks),
- descending: this.buildUserFlow(descendingLinks),
- }
- }
-
async getJourneys(
params: Record<string, unknown>,
filtersQuery: string,
diff --git a/backend/apps/cloud/src/analytics/dto/getUserFlow.dto.ts b/backend/apps/cloud/src/analytics/dto/getUserFlow.dto.ts
deleted file mode 100644
index 832756966..000000000
--- a/backend/apps/cloud/src/analytics/dto/getUserFlow.dto.ts
+++ /dev/null
@@ -1,39 +0,0 @@
-import { ApiProperty } from '@nestjs/swagger'
-import { IsNotEmpty, IsOptional, Matches } from 'class-validator'
-import { DEFAULT_TIMEZONE } from '../../user/entities/user.entity'
-import { ValidatePeriod } from '../decorators/validate-period.decorator'
-import { PID_REGEX } from '../../common/constants'
-
-export class GetUserFlowDto {
- @ApiProperty({
- example: 'aUn1quEid-3',
- required: true,
- description: 'The project ID',
- })
- @IsNotEmpty()
- @Matches(PID_REGEX, { message: 'The provided Project ID (pid) is incorrect' })
- pid: string
-
- @ApiProperty({ required: false })
- @IsOptional()
- @ValidatePeriod()
- period?: string
-
- @ApiProperty()
- from: string
-
- @ApiProperty()
- to: string
-
- @ApiProperty({
- description: 'Timezone to display data in',
- default: DEFAULT_TIMEZONE,
- })
- timezone: string
-
- @ApiProperty({
- description:
- 'A stringified array of properties to filter [{ column, filter, isExclusive, isContains }]',
- })
- filters: string
-}
diff --git a/backend/apps/cloud/src/analytics/interfaces/index.ts b/backend/apps/cloud/src/analytics/interfaces/index.ts
index 3d810e2f3..fd93e2aa5 100644
--- a/backend/apps/cloud/src/analytics/interfaces/index.ts
+++ b/backend/apps/cloud/src/analytics/interfaces/index.ts
@@ -78,31 +78,11 @@ export interface GetFiltersQuery extends Array<string | object | boolean> {
3: boolean
}
-export interface IUserFlowNode {
- id: string
-}
-
-export interface IUserFlowLink {
- source: string
- target: string
- value: number
-}
-
export interface IGenerateXAxis {
x: string[]
xShifted: string[]
}
-export interface IBuildUserFlow {
- nodes: IUserFlowNode[]
- links: IUserFlowLink[]
-}
-
-export interface IUserFlow {
- ascending: IBuildUserFlow
- descending: IBuildUserFlow
-}
-
export interface IJourney {
path: string[]
value: number
diff --git a/backend/apps/cloud/src/analytics/protection/public-project-cache.interceptor.ts b/backend/apps/cloud/src/analytics/protection/public-project-cache.interceptor.ts
index 1f7587d56..a108983b4 100644
--- a/backend/apps/cloud/src/analytics/protection/public-project-cache.interceptor.ts
+++ b/backend/apps/cloud/src/analytics/protection/public-project-cache.interceptor.ts
@@ -31,7 +31,6 @@ const CACHEABLE_ROUTES = new Set([
'error-overview',
'funnel',
'funnel-sessions',
- 'user-flow',
'custom-events',
'keywords',
'gsc-dashboard',
diff --git a/backend/apps/cloud/src/analytics/v2/analytics-v2.service.ts b/backend/apps/cloud/src/analytics/v2/analytics-v2.service.ts
index 0bda4fdbe..3d7756d4a 100644
--- a/backend/apps/cloud/src/analytics/v2/analytics-v2.service.ts
+++ b/backend/apps/cloud/src/analytics/v2/analytics-v2.service.ts
@@ -720,35 +720,6 @@ export class AnalyticsV2Service {
})
}
- async getTrafficUserFlow(
- pid: string,
- dto: V2BaseQueryDto,
- ): Promise<V2Envelope<unknown>> {
- const dataType: V2DataType = 'traffic'
- const filters = this.prepareFilters(dto.filters, dataType, true)
- const timeframe = await this.resolveTimeframe({
- pid,
- dataType,
- period: dto.period,
- from: dto.from,
- to: dto.to,
- timezone: dto.timezone,
- allTimeEventTypes: ['pageview'],
- })
-
- const flow = await this.analyticsService.getUserFlow(
- {
- pid,
- groupFrom: timeframe.groupFrom,
- groupTo: timeframe.groupTo,
- ...filters.filtersParams,
- },
- filters.filtersQuery,
- )
-
- return envelope(flow, this.baseMeta(pid, timeframe, filters.appliedFilters))
- }
-
async getPerformanceTimeseries(
pid: string,
dto: V2TimeseriesDto & { measure?: string },
diff --git a/backend/apps/cloud/src/analytics/v2/controllers/traffic-v2.controller.ts b/backend/apps/cloud/src/analytics/v2/controllers/traffic-v2.controller.ts
index 157186653..60c5b40db 100644
--- a/backend/apps/cloud/src/analytics/v2/controllers/traffic-v2.controller.ts
+++ b/backend/apps/cloud/src/analytics/v2/controllers/traffic-v2.controller.ts
@@ -296,29 +296,4 @@ export class TrafficV2Controller {
return this.analyticsV2Service.getTrafficPageProperties(pid, query)
}
-
- @Get('user-flow')
- @Auth(true, true)
- @CacheableAnalytics()
- @ApiOperation({
- summary: 'User flow',
- description:
- 'Page-to-page navigation flows (sankey nodes and links) for the selected period.',
- })
- async getUserFlow(
- @Param() { pid }: V2ProjectParamsDto,
- @Query() query: V2SummaryDto,
- @CurrentUserId() uid: string,
- @Headers() headers: { 'x-password'?: string },
- ) {
- this.logger.log(`pid: ${pid}`, 'GET /v2/projects/:pid/traffic/user-flow')
-
- await this.analyticsV2Service.assertReadAccess(
- pid,
- uid,
- headers['x-password'],
- )
-
- return this.analyticsV2Service.getTrafficUserFlow(pid, query)
- }
}
diff --git a/backend/apps/community/src/analytics/analytics.controller.ts b/backend/apps/community/src/analytics/analytics.controller.ts
index 1d140ec06..9c1f8a5e9 100644
--- a/backend/apps/community/src/analytics/analytics.controller.ts
+++ b/backend/apps/community/src/analytics/analytics.controller.ts
@@ -48,7 +48,6 @@ import { DataDeletionDto } from './dto/data-deletion.dto'
import { GetVersionFiltersDto } from './dto/get-version-filters.dto'
import { GetCustomEventMetadata } from './dto/get-custom-event-meta.dto'
import { GetPagePropertyMetaDto } from './dto/get-page-property-meta.dto'
-import { GetUserFlowDto } from './dto/getUserFlow.dto'
import { GetJourneysDto } from './dto/get-journeys.dto'
import { GetJourneySessionsDto } from './dto/get-journey-sessions.dto'
import { GetFunnelsDto } from './dto/getFunnels.dto'
@@ -58,13 +57,7 @@ import { clickhouse } from '../common/integrations/clickhouse'
import { checkRateLimit, getIPDetails, getIPFromHeaders } from '../common/utils'
import { GetCustomEventsDto } from './dto/get-custom-events.dto'
import { GetBotStatsDto } from './dto/get-bot-stats.dto'
-import {
- IFunnel,
- IGetFunnel,
- IPageProperty,
- IUserFlow,
- PerfMeasure,
-} from './interfaces'
+import { IFunnel, IGetFunnel, IPageProperty, PerfMeasure } from './interfaces'
import { GetSessionsDto } from './dto/get-sessions.dto'
import { GetSessionDto } from './dto/get-session.dto'
import { GetProfilesDto } from './dto/get-profiles.dto'
@@ -889,57 +882,6 @@ export class AnalyticsController {
return { chart, appliedFilters: parsedFilters }
}
- @Get('user-flow')
- @Auth(true, true)
- async getUserFlow(
- @Query() data: GetUserFlowDto,
- @CurrentUserId() uid: string,
- @Headers() headers: { 'x-password'?: string },
- ): Promise<IUserFlow | { appliedFilters: any[] }> {
- const { pid, period, from, to, timezone = DEFAULT_TIMEZONE, filters } = data
-
- await this.analyticsService.checkProjectAccess(
- pid,
- uid,
- headers['x-password'],
- )
-
- this.logger.log(
- `pid: ${pid}, period: ${period}`,
- 'GET /analytics/user-flow',
- )
-
- let diff
-
- if (period === 'all') {
- const res = await this.analyticsService.calculateTimeBucketForAllTime(
- pid,
- 'pageview',
- )
-
- diff = res.diff
- }
-
- const safeTimezone = this.analyticsService.getSafeTimezone(timezone)
- const { groupFrom, groupTo } = this.analyticsService.getGroupFromTo(
- from,
- to,
- null,
- period,
- safeTimezone,
- diff,
- )
-
- const [filtersQuery, filtersParams, parsedFilters] =
- this.analyticsService.getFiltersQuery(filters, DataType.ANALYTICS, true)
-
- const params = { pid, groupFrom, groupTo, ...filtersParams }
-
- const flow = await this.analyticsService.getUserFlow(params, filtersQuery)
-
- return { ...flow, appliedFilters: parsedFilters }
- }
-
@Get('journeys')
@Auth(true, true)
async getJourneys(
diff --git a/backend/apps/community/src/analytics/analytics.service.ts b/backend/apps/community/src/analytics/analytics.service.ts
index d69ebd9fe..37bfabe62 100644
--- a/backend/apps/community/src/analytics/analytics.service.ts
+++ b/backend/apps/community/src/analytics/analytics.service.ts
@@ -80,12 +80,8 @@ import {
TrafficCHResponse,
IGetGroupFromTo,
GetFiltersQuery,
- IUserFlowNode,
- IUserFlowLink,
- IUserFlow,
IJourney,
IJourneys,
- IBuildUserFlow,
IExtractChartData,
IGenerateXAxis,
IAggregatedMetadata,
@@ -947,100 +943,6 @@ export class AnalyticsService {
}
}
- removeCyclicDependencies(links: IUserFlowLink[]): IUserFlowLink[] {
- const visited = new Set<string>()
-
- return links.filter((link) => {
- const key = `${link.source}_${link.target}`
- if (visited.has(key)) {
- return false
- }
- visited.add(key)
- return true
- })
- }
-
- buildUserFlow(links: IUserFlowLink[]): IBuildUserFlow {
- const nodes: IUserFlowNode[] = Array.from(
- new Set(
- links
- .map((link: IUserFlowLink) => link.source)
- .concat(links.map((link: IUserFlowLink) => link.target)),
- ),
- ).map((node: any) => ({ id: node }))
-
- return { nodes, links }
- }
-
- async getUserFlow(
- params: Record<string, unknown>,
- filtersQuery: string,
- ): Promise<IUserFlow> {
- const query = `
- WITH page_sequences AS (
- SELECT
- psid,
- pg,
- created,
- lagInFrame(pg) OVER (PARTITION BY psid ORDER BY created) AS prev_page
- FROM events
- WHERE
- pid = {pid:FixedString(12)}
- AND type = 'pageview'
- AND created BETWEEN {groupFrom:String} AND {groupTo:String}
- AND pg IS NOT NULL
- ${filtersQuery}
- )
- SELECT
- prev_page AS source,
- pg AS target,
- count() AS value
- FROM page_sequences
- WHERE prev_page IS NOT NULL
- AND prev_page != pg
- GROUP BY
- source,
- target
- ORDER BY value DESC
- `
-
- const { data } = await clickhouse
- .query({
- query,
- query_params: params,
- })
- .then((res) => res.json<IUserFlowLink>())
-
- if (_isEmpty(data)) {
- const empty = { nodes: [], links: [] }
- return {
- ascending: empty,
- descending: empty,
- }
- }
-
- const ascendingLinks: IUserFlowLink[] = []
- const descendingLinks: IUserFlowLink[] = []
-
- this.removeCyclicDependencies(data).forEach((row: any) => {
- const link: IUserFlowLink = {
- source: row.source,
- target: row.target,
- value: row.value,
- }
- if (link.source < link.target) {
- ascendingLinks.push(link)
- } else {
- descendingLinks.push(link)
- }
- })
-
- return {
- ascending: this.buildUserFlow(ascendingLinks),
- descending: this.buildUserFlow(descendingLinks),
- }
- }
-
async getJourneys(
params: Record<string, unknown>,
filtersQuery: string,
diff --git a/backend/apps/community/src/analytics/dto/getUserFlow.dto.ts b/backend/apps/community/src/analytics/dto/getUserFlow.dto.ts
deleted file mode 100644
index 832756966..000000000
--- a/backend/apps/community/src/analytics/dto/getUserFlow.dto.ts
+++ /dev/null
@@ -1,39 +0,0 @@
-import { ApiProperty } from '@nestjs/swagger'
-import { IsNotEmpty, IsOptional, Matches } from 'class-validator'
-import { DEFAULT_TIMEZONE } from '../../user/entities/user.entity'
-import { ValidatePeriod } from '../decorators/validate-period.decorator'
-import { PID_REGEX } from '../../common/constants'
-
-export class GetUserFlowDto {
- @ApiProperty({
- example: 'aUn1quEid-3',
- required: true,
- description: 'The project ID',
- })
- @IsNotEmpty()
- @Matches(PID_REGEX, { message: 'The provided Project ID (pid) is incorrect' })
- pid: string
-
- @ApiProperty({ required: false })
- @IsOptional()
- @ValidatePeriod()
- period?: string
-
- @ApiProperty()
- from: string
-
- @ApiProperty()
- to: string
-
- @ApiProperty({
- description: 'Timezone to display data in',
- default: DEFAULT_TIMEZONE,
- })
- timezone: string
-
- @ApiProperty({
- description:
- 'A stringified array of properties to filter [{ column, filter, isExclusive, isContains }]',
- })
- filters: string
-}
diff --git a/backend/apps/community/src/analytics/interfaces/index.ts b/backend/apps/community/src/analytics/interfaces/index.ts
index b874c07d6..a0279566b 100644
--- a/backend/apps/community/src/analytics/interfaces/index.ts
+++ b/backend/apps/community/src/analytics/interfaces/index.ts
@@ -70,31 +70,11 @@ export interface GetFiltersQuery extends Array<string | object | boolean> {
3: boolean
}
-export interface IUserFlowNode {
- id: string
-}
-
-export interface IUserFlowLink {
- source: string
- target: string
- value: number
-}
-
export interface IGenerateXAxis {
x: string[]
xShifted: string[]
}
-export interface IBuildUserFlow {
- nodes: IUserFlowNode[]
- links: IUserFlowLink[]
-}
-
-export interface IUserFlow {
- ascending: IBuildUserFlow
- descending: IBuildUserFlow
-}
-
export interface IJourney {
path: string[]
value: number
diff --git a/backend/apps/community/src/analytics/protection/public-project-cache.interceptor.ts b/backend/apps/community/src/analytics/protection/public-project-cache.interceptor.ts
index d9184132f..57ee4c8cf 100644
--- a/backend/apps/community/src/analytics/protection/public-project-cache.interceptor.ts
+++ b/backend/apps/community/src/analytics/protection/public-project-cache.interceptor.ts
@@ -31,7 +31,6 @@ const CACHEABLE_ROUTES = new Set([
'error-overview',
'funnel',
'funnel-sessions',
- 'user-flow',
'custom-events',
'keywords',
'gsc-dashboard',
diff --git a/backend/apps/community/src/analytics/v2/analytics-v2.service.ts b/backend/apps/community/src/analytics/v2/analytics-v2.service.ts
index 04bdd555d..55606aeaa 100644
--- a/backend/apps/community/src/analytics/v2/analytics-v2.service.ts
+++ b/backend/apps/community/src/analytics/v2/analytics-v2.service.ts
@@ -719,35 +719,6 @@ export class AnalyticsV2Service {
})
}
- async getTrafficUserFlow(
- pid: string,
- dto: V2BaseQueryDto,
- ): Promise<V2Envelope<unknown>> {
- const dataType: V2DataType = 'traffic'
- const filters = this.prepareFilters(dto.filters, dataType, true)
- const timeframe = await this.resolveTimeframe({
- pid,
- dataType,
- period: dto.period,
- from: dto.from,
- to: dto.to,
- timezone: dto.timezone,
- allTimeEventTypes: ['pageview'],
- })
-
- const flow = await this.analyticsService.getUserFlow(
- {
- pid,
- groupFrom: timeframe.groupFrom,
- groupTo: timeframe.groupTo,
- ...filters.filtersParams,
- },
- filters.filtersQuery,
- )
-
- return envelope(flow, this.baseMeta(pid, timeframe, filters.appliedFilters))
- }
-
async getPerformanceTimeseries(
pid: string,
dto: V2TimeseriesDto & { measure?: string },
diff --git a/backend/apps/community/src/analytics/v2/controllers/traffic-v2.controller.ts b/backend/apps/community/src/analytics/v2/controllers/traffic-v2.controller.ts
index 157186653..60c5b40db 100644
--- a/backend/apps/community/src/analytics/v2/controllers/traffic-v2.controller.ts
+++ b/backend/apps/community/src/analytics/v2/controllers/traffic-v2.controller.ts
@@ -296,29 +296,4 @@ export class TrafficV2Controller {
return this.analyticsV2Service.getTrafficPageProperties(pid, query)
}
-
- @Get('user-flow')
- @Auth(true, true)
- @CacheableAnalytics()
- @ApiOperation({
- summary: 'User flow',
- description:
- 'Page-to-page navigation flows (sankey nodes and links) for the selected period.',
- })
- async getUserFlow(
- @Param() { pid }: V2ProjectParamsDto,
- @Query() query: V2SummaryDto,
- @CurrentUserId() uid: string,
- @Headers() headers: { 'x-password'?: string },
- ) {
- this.logger.log(`pid: ${pid}`, 'GET /v2/projects/:pid/traffic/user-flow')
-
- await this.analyticsV2Service.assertReadAccess(
- pid,
- uid,
- headers['x-password'],
- )
-
- return this.analyticsV2Service.getTrafficUserFlow(pid, query)
- }
}
diff --git a/docs/content/docs/api/stats-v2.mdx b/docs/content/docs/api/stats-v2.mdx
index 97899ae6f..a321df12b 100644
--- a/docs/content/docs/api/stats-v2.mdx
+++ b/docs/content/docs/api/stats-v2.mdx
@@ -282,10 +282,6 @@ Counts of pageview metadata (page property) keys: `data: [{ "property": "author"
Aggregated value counts for one page property (v1 `/log/property` equivalent). Requires `property`.
-### GET /v2/projects/:pid/traffic/user-flow
-
-Page-to-page navigation flows: `data: { "ascending": { "nodes": [...], "links": [...] }, "descending": { ... } }`.
-
## Performance endpoints
### GET /v2/projects/:pid/performance/summary
@@ -476,7 +472,6 @@ Distinct recorded values for a dimension — for filter autocompletion (`?type=t
| `GET /v1/log/meta` | `/traffic/custom-events/metadata` |
| `GET /v1/log/property` | `/traffic/page-properties/metadata` |
| `GET /v1/log/custom-events` | `/traffic/custom-events/timeseries` |
-| `GET /v1/log/user-flow` | `/traffic/user-flow` |
| `GET /v1/log/sessions` / `/log/session` | `/sessions` / `/sessions/:psid` |
| `GET /v1/log/profiles` / `/log/profile` / `/log/profile/sessions` | `/profiles` / `/profiles/:profileId` / `/profiles/:profileId/sessions` |
| `GET /v1/log/errors` / `/log/get-error` / `/log/error-overview` / `/log/error-sessions` | `/errors` / `/errors/:eid` / `/errors/overview` / `/errors/:eid/sessions` |
diff --git a/docs/content/docs/api/stats.mdx b/docs/content/docs/api/stats.mdx
index 1cda72b92..03818bfba 100644
--- a/docs/content/docs/api/stats.mdx
+++ b/docs/content/docs/api/stats.mdx
@@ -1257,19 +1257,6 @@ The number of sessions to return per page.
The number of sessions to skip (for pagination).
-### GET /v1/log/user-flow
-
-Returns the user flow diagram data, showing how users navigate through your website.
-
-```bash
-curl 'https://api.swetrix.com/v1/log/user-flow?pid=YOUR_PROJECT_ID&period=7d'\
- -H "X-Api-Key: ${SWETRIX_API_KEY}"
-```
-
-#### Parameters
-
-The parameters are similar to the [`/log` endpoint](#get-v1log).
-
### GET /v1/log/journeys
Returns the most popular journeys — the ordered sequences of pages visitors viewed within a session. This is the data behind the Journeys tab of the dashboard.
diff --git a/web/app/api/v2/endpoints.ts b/web/app/api/v2/endpoints.ts
index 9d2da8bfd..4360fc84f 100644
--- a/web/app/api/v2/endpoints.ts
+++ b/web/app/api/v2/endpoints.ts
@@ -12,7 +12,6 @@ import {
PerformanceSummaryData,
TimeseriesRow,
TrafficSummaryData,
- UserFlowData,
V2CommonParams,
V2DataType,
} from './types'
@@ -137,12 +136,6 @@ export const getPagePropertiesMetadata = (
signal,
)
-export const getUserFlow = (
- pid: string,
- params: Common,
- signal?: AbortSignal,
-) => fetchV2<UserFlowData>(`projects/${pid}/traffic/user-flow`, params, signal)
-
export const getErrorsList = (
pid: string,
params: Common & { limit?: number; offset?: number; show_resolved?: boolean },
diff --git a/web/app/api/v2/types.ts b/web/app/api/v2/types.ts
index bb9d8ec7f..a0c9921ce 100644
--- a/web/app/api/v2/types.ts
+++ b/web/app/api/v2/types.ts
@@ -115,26 +115,6 @@ export interface MetadataRow {
count: number
}
-interface UserFlowNode {
- id: string
-}
-
-interface UserFlowLink {
- source: string
- target: string
- value: number
-}
-
-interface UserFlowGraph {
- nodes: UserFlowNode[]
- links: UserFlowLink[]
-}
-
-export interface UserFlowData {
- ascending: UserFlowGraph
- descending: UserFlowGraph
-}
-
export interface ErrorListItem {
eid: string
name: string
diff --git a/web/app/hooks/v2/useV2Queries.ts b/web/app/hooks/v2/useV2Queries.ts
index 051e21d1e..c54f09d6e 100644
--- a/web/app/hooks/v2/useV2Queries.ts
+++ b/web/app/hooks/v2/useV2Queries.ts
@@ -282,17 +282,6 @@ export const usePagePropertiesQuery = (
})
}
-export const useUserFlowQuery = (opts: { enabled?: boolean } = {}) => {
- const { pid, common } = useV2CommonParams('traffic')
-
- return useQuery({
- queryKey: ['v2', pid, 'traffic', 'user-flow', common],
- queryFn: ({ signal }) => v2.getUserFlow(pid, common, signal),
- placeholderData: keepPreviousData,
- enabled: opts.enabled,
- })
-}
-
const LIST_PAGE_SIZE = 30
const listNextPageParam = (pageSize: number) => {
diff --git a/web/app/pages/Project/View/ViewProject.helpers.tsx b/web/app/pages/Project/View/ViewProject.helpers.tsx
index 32868aac0..3dfa83064 100644
--- a/web/app/pages/Project/View/ViewProject.helpers.tsx
+++ b/web/app/pages/Project/View/ViewProject.helpers.tsx
@@ -2372,7 +2372,6 @@ const typeNameMapping = (t: typeof i18next.t) => ({
error_name: t('project.mapping.error_name'),
error_message: t('project.mapping.error_message'),
error_filename: t('project.mapping.error_filename'),
- userFlow: t('project.mapping.userFlow'),
searchEngine: t('project.mapping.searchEngine'),
aiReferral: t('project.mapping.aiReferral'),
captcha_event: t('project.event'),
diff --git a/web/app/pages/Project/tabs/Traffic/TrafficView.tsx b/web/app/pages/Project/tabs/Traffic/TrafficView.tsx
index a64adc5b9..0dfda7109 100644
--- a/web/app/pages/Project/tabs/Traffic/TrafficView.tsx
+++ b/web/app/pages/Project/tabs/Traffic/TrafficView.tsx
@@ -52,7 +52,6 @@ import PageLinkRow from '~/pages/Project/tabs/Traffic/PageLinkRow'
import RefRow from '~/pages/Project/tabs/Traffic/RefRow'
import { SessionsDrawer } from '~/pages/Project/tabs/Traffic/SessionsDrawer'
import { TrafficChart } from '~/pages/Project/tabs/Traffic/TrafficChart'
-import UserFlow from '~/pages/Project/tabs/Traffic/UserFlow'
import { getChartPointWindow } from '~/pages/Project/View/utils/chartPoint'
import CCRow from '~/pages/Project/View/components/CCRow'
import { ChartContextMenu } from '~/pages/Project/View/components/ChartContextMenu'
@@ -727,11 +726,6 @@ const TrafficViewInner = ({
label: t('project.exitPages'),
dimension: 'exit_page',
},
- {
- id: 'userFlow',
- label: t('project.mapping.userFlow'),
- render: () => <UserFlow isReversed={false} setReversed={() => {}} />,
- },
{ id: 'host', label: t('project.mapping.host'), dimension: 'host' },
],
[t],
diff --git a/web/app/pages/Project/tabs/Traffic/UserFlow.tsx b/web/app/pages/Project/tabs/Traffic/UserFlow.tsx
deleted file mode 100644
index 2c5f7b7e8..000000000
--- a/web/app/pages/Project/tabs/Traffic/UserFlow.tsx
+++ /dev/null
@@ -1,98 +0,0 @@
-import { ResponsiveSankey } from '@nivo/sankey'
-import { ArrowClockwiseIcon, TreeStructureIcon } from '@phosphor-icons/react'
-import _isEmpty from 'lodash/isEmpty'
-import { memo } from 'react'
-import { useTranslation } from 'react-i18next'
-
-import { useUserFlowQuery } from '~/hooks/v2/useV2Queries'
-import { PanelEmptyState } from '~/pages/Project/View/Panels'
-import Button from '~/ui/Button'
-import Loader from '~/ui/Loader'
-import { Text } from '~/ui/Text'
-
-interface UserFlowProps {
- isReversed?: boolean
- setReversed: () => void
-}
-
-const UserFlow = ({ setReversed, isReversed }: UserFlowProps) => {
- const { t } = useTranslation('common')
- const { data, isLoading } = useUserFlowQuery()
- const userFlow = data?.data
-
- if (isLoading) {
- return <Loader />
- }
-
- if (
- !isReversed
- ? _isEmpty(userFlow?.ascending) ||
- _isEmpty(userFlow?.ascending?.nodes) ||
- _isEmpty(userFlow?.ascending?.links)
- : _isEmpty(userFlow?.descending) ||
- _isEmpty(userFlow?.descending?.links) ||
- _isEmpty(userFlow?.descending?.nodes)
- ) {
- return (
- <PanelEmptyState
- icon={
- <TreeStructureIcon className='size-5 text-gray-400 dark:text-slate-500' />
- }
- >
- <Text as='p' size='sm' colour='secondary'>
- {t('project.userFlow.noData')}
- </Text>
- <Button
- variant='icon'
- type='button'
- onClick={() => {
- setReversed()
- }}
- className='mt-3 gap-1.5 px-3 py-2'
- aria-label={t('project.reverse')}
- >
- <ArrowClockwiseIcon className='size-4' />
- {t('project.reverse')}
- </Button>
- </PanelEmptyState>
- )
- }
-
- return (
- <ResponsiveSankey
- // @ts-expect-error
- data={isReversed ? userFlow?.descending : userFlow?.ascending}
- margin={{
- top: 0,
- right: 0,
- bottom: 0,
- left: 20,
- }}
- align='justify'
- colors={{ scheme: 'nivo' }}
- nodeOpacity={1}
- nodeHoverOthersOpacity={0.35}
- nodeThickness={18}
- nodeSpacing={24}
- nodeBorderWidth={0}
- nodeBorderColor={{
- from: 'color',
- modifiers: [['darker', 0.8]],
- }}
- nodeBorderRadius={3}
- linkOpacity={0.5}
- linkHoverOthersOpacity={0.1}
- linkContract={3}
- enableLinkGradient
- labelPosition='outside'
- labelOrientation='vertical'
- labelPadding={16}
- labelTextColor={{
- from: 'color',
- modifiers: [['darker', 1]],
- }}
- />
- )
-}
-
-export default memo(UserFlow)