📈 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
Profiles UI
Blue Mousec832af7fc948
diff --git a/backend/apps/cloud/src/analytics/analytics.controller.ts b/backend/apps/cloud/src/analytics/analytics.controller.tsindex 75ba316d0..13b492b60 100644--- a/backend/apps/cloud/src/analytics/analytics.controller.ts+++ b/backend/apps/cloud/src/analytics/analytics.controller.ts@@ -74,6 +74,8 @@ import {} from './interfaces'import { GetSessionsDto } from './dto/get-sessions.dto'import { GetSessionDto } from './dto/get-session.dto'+import { GetProfilesDto } from './dto/get-profiles.dto'+import { GetProfileDto, GetProfileSessionsDto } from './dto/get-profile.dto'import { ErrorDto } from './dto/error.dto'import { GetErrorsDto } from './dto/get-errors.dto'import { GetErrorDto } from './dto/get-error.dto'@@ -1857,6 +1859,248 @@ export class AnalyticsController {return result}+ @Get('profiles')+ @Auth(true, true)+ async getProfiles(+ @Query() data: GetProfilesDto,+ @CurrentUserId() uid: string,+ @Headers() headers: { 'x-password'?: string },+ ) {+ const {+ pid,+ period,+ from,+ to,+ filters,+ timezone = DEFAULT_TIMEZONE,+ search,+ profileType = 'all',+ } = data++ await this.analyticsService.checkProjectAccess(+ pid,+ uid,+ headers['x-password'],+ )++ await this.analyticsService.checkBillingAccess(pid)++ const take = this.analyticsService.getSafeNumber(data.take, 30)+ const skip = this.analyticsService.getSafeNumber(data.skip, 0)++ if (take > 150) {+ throw new BadRequestException(+ 'The maximum number of profiles to return is 150',+ )+ }++ let timeBucket+ let diff++ if (period === 'all') {+ const res = await this.analyticsService.calculateTimeBucketForAllTime(+ pid,+ 'analytics',+ )++ timeBucket = res.timeBucket[0]+ diff = res.diff+ } else {+ timeBucket = getLowestPossibleTimeBucket(period, from, to)+ }++ const [filtersQuery, filtersParams, appliedFilters] =+ this.analyticsService.getFiltersQuery(filters, DataType.ANALYTICS)++ const safeTimezone = this.analyticsService.getSafeTimezone(timezone)+ const { groupFromUTC, groupToUTC } = this.analyticsService.getGroupFromTo(+ from,+ to,+ timeBucket,+ period,+ safeTimezone,+ diff,+ )++ const paramsData = {+ params: {+ pid,+ groupFrom: groupFromUTC,+ groupTo: groupToUTC,+ ...filtersParams,+ },+ }++ const profiles = await this.analyticsService.getProfilesList(+ pid,+ filtersQuery,+ paramsData,+ safeTimezone,+ take,+ skip,+ search,+ profileType,+ )++ return { profiles, appliedFilters, take, skip }+ }++ @Get('profile')+ @Auth(true, true)+ async getProfile(+ @Query() data: GetProfileDto,+ @CurrentUserId() uid: string,+ @Headers() headers: { 'x-password'?: string },+ ) {+ const {+ pid,+ profileId,+ timezone = DEFAULT_TIMEZONE,+ period,+ from,+ to,+ } = data++ await this.analyticsService.checkProjectAccess(+ pid,+ uid,+ headers['x-password'],+ )++ await this.analyticsService.checkBillingAccess(pid)++ const safeTimezone = this.analyticsService.getSafeTimezone(timezone)++ let timeBucket+ let diff++ if (period === 'all') {+ const res = await this.analyticsService.calculateTimeBucketForAllTime(+ pid,+ 'analytics',+ )+ timeBucket = res.timeBucket[0]+ diff = res.diff+ } else {+ timeBucket = getLowestPossibleTimeBucket(period, from, to)+ }++ const { groupFromUTC, groupToUTC } = this.analyticsService.getGroupFromTo(+ from,+ to,+ timeBucket,+ period,+ safeTimezone,+ diff,+ )++ const [details, topPages, activityCalendar, chart] = await Promise.all([+ this.analyticsService.getProfileDetails(pid, profileId, safeTimezone),+ this.analyticsService.getProfileTopPages(pid, profileId),+ this.analyticsService.getProfileActivityCalendar(pid, profileId),+ this.analyticsService.getProfileChartData(+ pid,+ profileId,+ timeBucket,+ groupFromUTC,+ groupToUTC,+ safeTimezone,+ ),+ ])++ return {+ ...details,+ topPages,+ activityCalendar,+ chart,+ timeBucket,+ }+ }++ @Get('profile/sessions')+ @Auth(true, true)+ async getProfileSessions(+ @Query() data: GetProfileSessionsDto,+ @CurrentUserId() uid: string,+ @Headers() headers: { 'x-password'?: string },+ ) {+ const {+ pid,+ profileId,+ period,+ from,+ to,+ filters,+ timezone = DEFAULT_TIMEZONE,+ } = data++ await this.analyticsService.checkProjectAccess(+ pid,+ uid,+ headers['x-password'],+ )++ await this.analyticsService.checkBillingAccess(pid)++ const take = this.analyticsService.getSafeNumber(data.take, 30)+ const skip = this.analyticsService.getSafeNumber(data.skip, 0)++ if (take > 150) {+ throw new BadRequestException(+ 'The maximum number of sessions to return is 150',+ )+ }++ let timeBucket+ let diff++ if (period === 'all') {+ const res = await this.analyticsService.calculateTimeBucketForAllTime(+ pid,+ 'analytics',+ )++ timeBucket = res.timeBucket[0]+ diff = res.diff+ } else {+ timeBucket = getLowestPossibleTimeBucket(period, from, to)+ }++ const [filtersQuery, filtersParams, appliedFilters] =+ this.analyticsService.getFiltersQuery(filters, DataType.ANALYTICS)++ const safeTimezone = this.analyticsService.getSafeTimezone(timezone)+ const { groupFromUTC, groupToUTC } = this.analyticsService.getGroupFromTo(+ from,+ to,+ timeBucket,+ period,+ safeTimezone,+ diff,+ )++ const paramsData = {+ params: {+ pid,+ groupFrom: groupFromUTC,+ groupTo: groupToUTC,+ ...filtersParams,+ },+ }++ const sessions = await this.analyticsService.getProfileSessionsList(+ pid,+ profileId,+ filtersQuery,+ paramsData,+ safeTimezone,+ take,+ skip,+ )++ return { sessions, appliedFilters, take, skip }+ }+@Get('custom-events')@Auth(true, true)async getCustomEvents(diff --git a/backend/apps/cloud/src/analytics/analytics.service.ts b/backend/apps/cloud/src/analytics/analytics.service.tsindex 2e7e85d16..ebf75b25c 100644--- a/backend/apps/cloud/src/analytics/analytics.service.ts+++ b/backend/apps/cloud/src/analytics/analytics.service.ts@@ -4287,6 +4287,454 @@ export class AnalyticsService {return data}+ async getProfilesList(+ pid: string,+ filtersQuery: string,+ paramsData: any,+ safeTimezone: string,+ take = 30,+ skip = 0,+ search?: string,+ profileType: 'all' | 'anonymous' | 'identified' = 'all',+ ): Promise<object[]> {+ let profileTypeFilter = ''+ if (profileType === 'anonymous') {+ profileTypeFilter = `AND profileId LIKE '${AnalyticsService.PROFILE_PREFIX_ANON}%'`+ } else if (profileType === 'identified') {+ profileTypeFilter = `AND profileId LIKE '${AnalyticsService.PROFILE_PREFIX_USER}%'`+ }++ let searchFilter = ''+ if (search) {+ searchFilter = `AND profileId LIKE '%${search}%'`+ }++ const query = `+ WITH profile_sessions AS (+ SELECT+ profileId,+ count() AS sessionsCount,+ sum(pageviews) AS pageviewsCount,+ sum(events) AS eventsCount,+ min(firstSeen) AS firstSeen,+ max(lastSeen) AS lastSeen+ FROM sessions FINAL+ WHERE pid = {pid:FixedString(12)}+ AND profileId IS NOT NULL+ AND profileId != ''+ ${profileTypeFilter}+ ${searchFilter}+ GROUP BY profileId+ ),+ profile_details AS (+ SELECT+ profileId,+ any(cc) AS cc,+ any(os) AS os,+ any(br) AS br,+ any(dv) AS dv+ FROM analytics+ WHERE pid = {pid:FixedString(12)}+ AND profileId IS NOT NULL+ AND profileId != ''+ ${profileTypeFilter}+ ${searchFilter}+ ${filtersQuery}+ GROUP BY profileId+ )+ SELECT+ ps.profileId,+ ps.sessionsCount,+ ps.pageviewsCount,+ ps.eventsCount,+ ps.firstSeen,+ ps.lastSeen,+ pd.cc,+ pd.os,+ pd.br,+ pd.dv+ FROM profile_sessions ps+ LEFT JOIN profile_details pd ON ps.profileId = pd.profileId+ ORDER BY ps.lastSeen DESC+ LIMIT ${take}+ OFFSET ${skip}+ `++ const { data } = await clickhouse+ .query({+ query,+ query_params: { pid, ...paramsData.params },+ })+ .then(resultSet => resultSet.json())++ return data.map((profile: any) => ({+ ...profile,+ isIdentified: this.isUserSuppliedProfile(profile.profileId),+ }))+ }++ async getProfileDetails(+ pid: string,+ profileId: string,+ _safeTimezone: string,+ ): Promise<any> {+ // Query sessions for session count and duration+ const querySessionStats = `+ SELECT+ count() AS sessionsCount,+ min(sessions.firstSeen) AS firstSeen,+ max(sessions.lastSeen) AS lastSeen,+ avg(dateDiff('second', sessions.firstSeen, sessions.lastSeen)) AS avgDuration+ FROM sessions FINAL+ WHERE pid = {pid:FixedString(12)}+ AND profileId = {profileId:String}+ `++ // Query analytics for accurate pageview count+ const queryPageviews = `+ SELECT count() AS pageviewsCount+ FROM analytics+ WHERE pid = {pid:FixedString(12)}+ AND profileId = {profileId:String}+ `++ // Query customEV for accurate events count+ const queryEvents = `+ SELECT count() AS eventsCount+ FROM customEV+ WHERE pid = {pid:FixedString(12)}+ AND profileId = {profileId:String}+ `++ // Query for device/location details+ const queryDetails = `+ SELECT+ any(cc) AS cc,+ any(rg) AS rg,+ any(ct) AS ct,+ any(os) AS os,+ any(osv) AS osv,+ any(br) AS br,+ any(brv) AS brv,+ any(dv) AS dv,+ any(lc) AS lc+ FROM analytics+ WHERE pid = {pid:FixedString(12)}+ AND profileId = {profileId:String}+ `++ const params = { pid, profileId }++ const [sessionStatsResult, pageviewsResult, eventsResult, detailsResult] =+ await Promise.all([+ clickhouse+ .query({ query: querySessionStats, query_params: params })+ .then(resultSet => resultSet.json()),+ clickhouse+ .query({ query: queryPageviews, query_params: params })+ .then(resultSet => resultSet.json()),+ clickhouse+ .query({ query: queryEvents, query_params: params })+ .then(resultSet => resultSet.json()),+ clickhouse+ .query({ query: queryDetails, query_params: params })+ .then(resultSet => resultSet.json()),+ ])++ const sessionStats = (sessionStatsResult.data[0] || {}) as Record<+ string,+ any+ >+ const pageviews = (pageviewsResult.data[0] || {}) as Record<string, any>+ const events = (eventsResult.data[0] || {}) as Record<string, any>+ const details = (detailsResult.data[0] || {}) as Record<string, any>++ return {+ profileId,+ isIdentified: this.isUserSuppliedProfile(profileId),+ sessionsCount: sessionStats.sessionsCount || 0,+ pageviewsCount: pageviews.pageviewsCount || 0,+ eventsCount: events.eventsCount || 0,+ firstSeen: sessionStats.firstSeen,+ lastSeen: sessionStats.lastSeen,+ avgDuration: sessionStats.avgDuration || 0,+ ...details,+ }+ }++ async getProfileTopPages(+ pid: string,+ profileId: string,+ limit = 10,+ ): Promise<{ page: string; count: number }[]> {+ const query = `+ SELECT+ pg AS page,+ count() AS count+ FROM analytics+ WHERE pid = {pid:FixedString(12)}+ AND profileId = {profileId:String}+ GROUP BY pg+ ORDER BY count DESC+ LIMIT ${limit}+ `++ const { data } = await clickhouse+ .query({+ query,+ query_params: { pid, profileId },+ })+ .then(resultSet => resultSet.json())++ return data as { page: string; count: number }[]+ }++ async getProfileActivityCalendar(+ pid: string,+ profileId: string,+ months = 4,+ ): Promise<{ date: string; count: number }[]> {+ const startDate = dayjs+ .utc()+ .subtract(months, 'month')+ .startOf('day')+ .format('YYYY-MM-DD')++ const query = `+ SELECT+ toDate(created) AS date,+ count() AS count+ FROM analytics+ WHERE pid = {pid:FixedString(12)}+ AND profileId = {profileId:String}+ AND created >= {startDate:Date}+ GROUP BY date+ ORDER BY date ASC+ `++ const { data } = await clickhouse+ .query({+ query,+ query_params: { pid, profileId, startDate },+ })+ .then(resultSet => resultSet.json())++ return data as { date: string; count: number }[]+ }++ async getProfileChartData(+ pid: string,+ profileId: string,+ timeBucket: string,+ from: string,+ to: string,+ safeTimezone: string,+ ): Promise<{+ x: string[]+ pageviews: number[]+ customEvents: number[]+ errors: number[]+ }> {+ const timeBucketFunc =+ timeBucketConversion[timeBucket] || timeBucketConversion.day++ const queryPageviews = `+ SELECT+ ${timeBucketFunc}(toTimeZone(created, '${safeTimezone}')) AS time,+ count() AS count+ FROM analytics+ WHERE pid = {pid:FixedString(12)}+ AND profileId = {profileId:String}+ AND created BETWEEN {from:String} AND {to:String}+ GROUP BY time+ ORDER BY time ASC+ `++ const queryEvents = `+ SELECT+ ${timeBucketFunc}(toTimeZone(created, '${safeTimezone}')) AS time,+ count() AS count+ FROM customEV+ WHERE pid = {pid:FixedString(12)}+ AND profileId = {profileId:String}+ AND created BETWEEN {from:String} AND {to:String}+ GROUP BY time+ ORDER BY time ASC+ `++ const queryErrors = `+ SELECT+ ${timeBucketFunc}(toTimeZone(created, '${safeTimezone}')) AS time,+ count() AS count+ FROM errors+ WHERE pid = {pid:FixedString(12)}+ AND profileId = {profileId:String}+ AND created BETWEEN {from:String} AND {to:String}+ GROUP BY time+ ORDER BY time ASC+ `++ const params = { pid, profileId, from, to }++ const [pageviewsResult, eventsResult, errorsResult] = await Promise.all([+ clickhouse+ .query({ query: queryPageviews, query_params: params })+ .then(resultSet => resultSet.json()),+ clickhouse+ .query({ query: queryEvents, query_params: params })+ .then(resultSet => resultSet.json()),+ clickhouse+ .query({ query: queryErrors, query_params: params })+ .then(resultSet => resultSet.json()),+ ])++ // Merge all timestamps and create aligned data+ const allTimes = new Set<string>()+ const pageviewsMap = new Map<string, number>()+ const eventsMap = new Map<string, number>()+ const errorsMap = new Map<string, number>()++ for (const row of pageviewsResult.data as {+ time: string+ count: number+ }[]) {+ allTimes.add(row.time)+ pageviewsMap.set(row.time, Number(row.count))+ }++ for (const row of eventsResult.data as {+ time: string+ count: number+ }[]) {+ allTimes.add(row.time)+ eventsMap.set(row.time, Number(row.count))+ }++ for (const row of errorsResult.data as {+ time: string+ count: number+ }[]) {+ allTimes.add(row.time)+ errorsMap.set(row.time, Number(row.count))+ }++ const sortedTimes = Array.from(allTimes).sort()++ return {+ x: sortedTimes,+ pageviews: sortedTimes.map(t => pageviewsMap.get(t) || 0),+ customEvents: sortedTimes.map(t => eventsMap.get(t) || 0),+ errors: sortedTimes.map(t => errorsMap.get(t) || 0),+ }+ }++ async getProfileSessionsList(+ pid: string,+ profileId: string,+ filtersQuery: string,+ paramsData: any,+ safeTimezone: string,+ take = 30,+ skip = 0,+ ): Promise<object[]> {+ const query = `+ WITH profile_sessions AS (+ SELECT+ CAST(psid, 'String') AS psidCasted,+ pid,+ profileId,+ any(cc) AS cc,+ any(os) AS os,+ any(br) AS br,+ min(toTimeZone(created, '${safeTimezone}')) AS sessionStart,+ max(toTimeZone(created, '${safeTimezone}')) AS lastActivity+ FROM analytics+ WHERE pid = {pid:FixedString(12)}+ AND profileId = {profileId:String}+ AND psid IS NOT NULL+ AND created BETWEEN {groupFrom:String} AND {groupTo:String}+ ${filtersQuery}+ GROUP BY psidCasted, pid, profileId+ ),+ pageview_counts AS (+ SELECT+ CAST(psid, 'String') AS psidCasted,+ pid,+ count() as count+ FROM analytics+ WHERE pid = {pid:FixedString(12)}+ AND profileId = {profileId:String}+ AND psid IS NOT NULL+ AND created BETWEEN {groupFrom:String} AND {groupTo:String}+ GROUP BY psidCasted, pid+ ),+ event_counts AS (+ SELECT+ CAST(psid, 'String') AS psidCasted,+ pid,+ count() as count+ FROM customEV+ WHERE pid = {pid:FixedString(12)}+ AND profileId = {profileId:String}+ AND psid IS NOT NULL+ AND created BETWEEN {groupFrom:String} AND {groupTo:String}+ GROUP BY psidCasted, pid+ ),+ error_counts AS (+ SELECT+ CAST(psid, 'String') AS psidCasted,+ pid,+ count() as count+ FROM errors+ WHERE pid = {pid:FixedString(12)}+ AND profileId = {profileId:String}+ AND psid IS NOT NULL+ AND created BETWEEN {groupFrom:String} AND {groupTo:String}+ GROUP BY psidCasted, pid+ ),+ session_duration_agg AS (+ SELECT+ CAST(psid, 'String') AS psidCasted,+ pid,+ avg(dateDiff('second', firstSeen, lastSeen)) as avg_duration+ FROM sessions FINAL+ WHERE pid = {pid:FixedString(12)}+ AND profileId = {profileId:String}+ GROUP BY psidCasted, pid+ )+ SELECT+ ps.psidCasted AS psid,+ ps.cc,+ ps.os,+ ps.br,+ COALESCE(pc.count, 0) AS pageviews,+ COALESCE(ec.count, 0) AS customEvents,+ COALESCE(errc.count, 0) AS errors,+ ps.sessionStart,+ ps.lastActivity,+ if(dateDiff('second', ps.lastActivity, now()) < ${LIVE_SESSION_THRESHOLD_SECONDS}, 1, 0) AS isLive,+ sda.avg_duration AS sdur+ FROM profile_sessions ps+ LEFT JOIN pageview_counts pc ON ps.psidCasted = pc.psidCasted AND ps.pid = pc.pid+ LEFT JOIN event_counts ec ON ps.psidCasted = ec.psidCasted AND ps.pid = ec.pid+ LEFT JOIN error_counts errc ON ps.psidCasted = errc.psidCasted AND ps.pid = errc.pid+ LEFT JOIN session_duration_agg sda ON ps.psidCasted = sda.psidCasted AND ps.pid = sda.pid+ WHERE ps.psidCasted IS NOT NULL+ ORDER BY ps.sessionStart DESC+ LIMIT ${take}+ OFFSET ${skip}+ `++ const { data } = await clickhouse+ .query({+ query,+ query_params: { pid, profileId, ...paramsData.params },+ })+ .then(resultSet => resultSet.json())++ return data as object[]+ }+async getErrorsList(options: string,filtersQuery: string,diff --git a/backend/apps/cloud/src/analytics/dto/get-profile.dto.ts b/backend/apps/cloud/src/analytics/dto/get-profile.dto.tsnew file mode 100644index 000000000..9673c2cfb--- /dev/null+++ b/backend/apps/cloud/src/analytics/dto/get-profile.dto.ts@@ -0,0 +1,66 @@+import { ApiProperty, PickType } from '@nestjs/swagger'+import { IsNotEmpty, IsOptional, Matches } from 'class-validator'+import { DEFAULT_TIMEZONE } from '../../user/entities/user.entity'+import { PID_REGEX } from '../../common/constants'+import { ValidatePeriod } from '../decorators/validate-period.decorator'+import { GetDataDto } from './getData.dto'++export class GetProfileDto {+ @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: true,+ description: 'The profile ID',+ })+ @IsNotEmpty()+ profileId: string++ @ApiProperty({+ description: 'Timezone to display data in',+ default: DEFAULT_TIMEZONE,+ })+ @IsOptional()+ timezone?: string++ @ApiProperty({ required: false })+ @IsOptional()+ @ValidatePeriod()+ period?: string++ @ApiProperty({ required: false })+ from?: string++ @ApiProperty({ required: false })+ to?: string+}++export class GetProfileSessionsDto extends PickType(GetDataDto, [+ 'pid',+ 'period',+ 'from',+ 'to',+ 'filters',+ 'timezone',+] as const) {+ @ApiProperty({+ required: true,+ description: 'The profile ID',+ })+ @IsNotEmpty()+ profileId: string++ @ApiProperty({ required: false, default: 30 })+ @IsOptional()+ take?: number++ @ApiProperty({ required: false, default: 0 })+ @IsOptional()+ skip?: number+}diff --git a/backend/apps/cloud/src/analytics/dto/get-profiles.dto.ts b/backend/apps/cloud/src/analytics/dto/get-profiles.dto.tsnew file mode 100644index 000000000..e51c98a23--- /dev/null+++ b/backend/apps/cloud/src/analytics/dto/get-profiles.dto.ts@@ -0,0 +1,37 @@+import { ApiProperty, PickType } from '@nestjs/swagger'+import { IsOptional, IsIn } from 'class-validator'+import { GetDataDto } from './getData.dto'++export class GetProfilesDto extends PickType(GetDataDto, [+ 'pid',+ 'period',+ 'from',+ 'to',+ 'filters',+ 'timezone',+] as const) {+ @ApiProperty({ required: false, default: 30 })+ @IsOptional()+ take?: number++ @ApiProperty({ required: false, default: 0 })+ @IsOptional()+ skip?: number++ @ApiProperty({+ required: false,+ description: 'Search by profileId or display name',+ })+ @IsOptional()+ search?: string++ @ApiProperty({+ required: false,+ description: 'Filter by profile type',+ enum: ['all', 'anonymous', 'identified'],+ default: 'all',+ })+ @IsOptional()+ @IsIn(['all', 'anonymous', 'identified'])+ profileType?: 'all' | 'anonymous' | 'identified'+}diff --git a/web/app/api/index.ts b/web/app/api/index.tsindex df282d240..fd6d3c857 100644--- a/web/app/api/index.ts+++ b/web/app/api/index.ts@@ -19,6 +19,8 @@ import {SwetrixErrorDetails,SessionDetails,Session,+ Profile,+ ProfileDetails,} from '~/lib/models/Project'import { Stats } from '~/lib/models/Stats'import { Subscriber } from '~/lib/models/Subscriber'@@ -664,6 +666,86 @@ export const getSession = (pid: string, psid: string, timezone = '', password: sthrow _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message})+export const getProfiles = (+ pid: string,+ period = '3d',+ filters: any[] = [],+ from = '',+ to = '',+ take = 30,+ skip = 0,+ timezone = '',+ search = '',+ profileType: 'all' | 'anonymous' | 'identified' = 'all',+ password: string | undefined = '',+) =>+ api+ .get(+ `log/profiles?pid=${pid}&take=${take}&skip=${skip}&period=${period}&filters=${JSON.stringify(+ filters,+ )}&from=${from}&to=${to}&timezone=${timezone}&search=${search}&profileType=${profileType}`,+ {+ headers: {+ 'x-password': password,+ },+ },+ )+ .then((response): { profiles: Profile[]; take: number; skip: number; appliedFilters: Filter[] } => response.data)+ .catch((error) => {+ throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message+ })++export const getProfile = (+ pid: string,+ profileId: string,+ period = '7d',+ from = '',+ to = '',+ timezone = '',+ password: string | undefined = '',+) =>+ api+ .get(+ `log/profile?pid=${pid}&profileId=${encodeURIComponent(profileId)}&period=${period}&from=${from}&to=${to}&timezone=${timezone}`,+ {+ headers: {+ 'x-password': password,+ },+ },+ )+ .then((response): ProfileDetails & { chart: any; timeBucket: string } => response.data)+ .catch((error) => {+ throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message+ })++export const getProfileSessions = (+ pid: string,+ profileId: string,+ period = '3d',+ filters: any[] = [],+ from = '',+ to = '',+ take = 30,+ skip = 0,+ timezone = '',+ password: string | undefined = '',+) =>+ api+ .get(+ `log/profile/sessions?pid=${pid}&profileId=${encodeURIComponent(profileId)}&take=${take}&skip=${skip}&period=${period}&filters=${JSON.stringify(+ filters,+ )}&from=${from}&to=${to}&timezone=${timezone}`,+ {+ headers: {+ 'x-password': password,+ },+ },+ )+ .then((response): { sessions: Session[]; take: number; skip: number; appliedFilters: Filter[] } => response.data)+ .catch((error) => {+ throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message+ })+export const getError = (pid: string,eid: string,diff --git a/web/app/lib/constants/index.ts b/web/app/lib/constants/index.tsindex 910e7f47f..c2e72e5c1 100644--- a/web/app/lib/constants/index.ts+++ b/web/app/lib/constants/index.ts@@ -472,6 +472,7 @@ export const roles: Role[] = ['admin', 'viewer']const SELFHOSTED_PROJECT_TABS = {traffic: 'traffic',performance: 'performance',+ users: 'users',funnels: 'funnels',sessions: 'sessions',errors: 'errors',@@ -480,6 +481,7 @@ const SELFHOSTED_PROJECT_TABS = {const PRODUCTION_PROJECT_TABS = {traffic: 'traffic',performance: 'performance',+ users: 'users',funnels: 'funnels',sessions: 'sessions',errors: 'errors',diff --git a/web/app/lib/models/Project.ts b/web/app/lib/models/Project.tsindex 38e096a65..b6e894eca 100644--- a/web/app/lib/models/Project.ts+++ b/web/app/lib/models/Project.ts@@ -119,6 +119,38 @@ export interface SessionDetails {isLive?: boolean}+export interface Profile {+ profileId: string+ isIdentified: boolean+ sessionsCount: number+ pageviewsCount: number+ eventsCount: number+ firstSeen: string+ lastSeen: string+ cc: string | null+ os: string | null+ br: string | null+ dv: string | null+}++export interface ProfileDetails extends Profile {+ avgDuration: number+ rg: string | null+ ct: string | null+ lc: string | null+ osv: string | null+ brv: string | null+ topPages: { page: string; count: number }[]+ activityCalendar: { date: string; count: number }[]+ chart?: {+ x: string[]+ pageviews: number[]+ customEvents: number[]+ errors: number[]+ }+ timeBucket?: string+}+export interface AnalyticsFunnel {value: stringevents: numberdiff --git a/web/app/pages/Project/View/ViewProject.helpers.tsx b/web/app/pages/Project/View/ViewProject.helpers.tsxindex b781a04f6..a5f1106c6 100644--- a/web/app/pages/Project/View/ViewProject.helpers.tsx+++ b/web/app/pages/Project/View/ViewProject.helpers.tsx@@ -1666,13 +1666,14 @@ const getFormatDate = (date: Date) => {const SHORTCUTS_TABS_MAP = {T: PROJECT_TABS.traffic,P: PROJECT_TABS.performance,+ U: PROJECT_TABS.users,F: PROJECT_TABS.funnels,S: PROJECT_TABS.sessions,A: PROJECT_TABS.alerts,R: PROJECT_TABS.errors,}-const _SHORTCUTS_TABS_LISTENERS = 'shift+t, shift+p, shift+s, shift+f, shift+e, shift+r'+const _SHORTCUTS_TABS_LISTENERS = 'shift+t, shift+p, shift+u, shift+s, shift+f, shift+e, shift+r'const SHORTCUTS_TABS_LISTENERS = isSelfhosted ? _SHORTCUTS_TABS_LISTENERS : _SHORTCUTS_TABS_LISTENERS + ', shift+a'const _SHORTCUTS_GENERAL_LISTENERS = 'alt+s,alt+ß, alt+b,alt+∫, alt+l,alt+¬, r'diff --git a/web/app/pages/Project/View/ViewProject.tsx b/web/app/pages/Project/View/ViewProject.tsxindex 5d5183c12..ec409b412 100644--- a/web/app/pages/Project/View/ViewProject.tsx+++ b/web/app/pages/Project/View/ViewProject.tsx@@ -24,6 +24,7 @@ import {GaugeIcon,Trash2Icon,UsersIcon,+ UserIcon,BellRingIcon,ChartNoAxesColumnIcon,FilterIcon,@@ -82,6 +83,9 @@ import {createAnnotation,updateAnnotation,deleteAnnotation,+ getProfiles,+ getProfile,+ getProfileSessions,} from '~/api'import EventsRunningOutBanner from '~/components/EventsRunningOutBanner'import Footer from '~/components/Footer'@@ -130,6 +134,8 @@ import {SessionDetails as SessionDetailsModel,Session,Annotation,+ Profile,+ ProfileDetails,} from '~/lib/models/Project'import AnnotationModal from '~/modals/AnnotationModal'import NewFunnel from '~/modals/NewFunnel'@@ -187,6 +193,8 @@ import SearchFilters, { getFiltersUrlParams } from './components/SearchFilters'import { SessionChart } from './components/SessionChart'import { SessionDetails } from './components/SessionDetails'import { Sessions } from './components/Sessions'+import { Users, UsersFilter } from './components/Users'+import { UserDetails } from './components/UserDetails'import TBPeriodSelector from './components/TBPeriodSelector'import { TrafficChart } from './components/TrafficChart'import UserFlow from './components/UserFlow'@@ -679,6 +687,26 @@ const ViewProjectContent = () => {const sessionsRequestIdRef = useRef(0)const skipNextSessionsAutoLoadRef = useRef(false)+ // profiles / users+ const [profilesSkip, setProfilesSkip] = useState(0)+ const [canLoadMoreProfiles, setCanLoadMoreProfiles] = useState(false)+ const [profiles, setProfiles] = useState<Profile[]>([])+ const [profilesLoading, setProfilesLoading] = useState<boolean | null>(null)+ const [activeProfile, setActiveProfile] = useState<ProfileDetails | null>(null)+ const [profileLoading, setProfileLoading] = useState(false)+ const [profileSessions, setProfileSessions] = useState<Session[]>([])+ const [profileSessionsLoading, setProfileSessionsLoading] = useState<boolean | null>(null)+ const [profileSessionsSkip, setProfileSessionsSkip] = useState(0)+ const [canLoadMoreProfileSessions, setCanLoadMoreProfileSessions] = useState(false)+ const [profileTypeFilter, setProfileTypeFilter] = useState<'all' | 'anonymous' | 'identified'>('all')+ const [profileSearch, setProfileSearch] = useState('')+ const activeProfileId = useMemo(() => {+ return searchParams.get('profileId')+ }, [searchParams])+ const prevActiveProfileIdRef = useRef<string | null>(activeProfileId)+ const profilesRequestIdRef = useRef(0)+ const skipNextProfilesAutoLoadRef = useRef(false)+// errorsconst [errorsSkip, setErrorsSkip] = useState(0)const [canLoadMoreErrors, setCanLoadMoreErrors] = useState(false)@@ -1441,6 +1469,11 @@ const ViewProjectContent = () => {label: t('dashboard.performance'),icon: GaugeIcon,},+ {+ id: PROJECT_TABS.users,+ label: t('dashboard.users'),+ icon: UserIcon,+ },{id: PROJECT_TABS.sessions,label: t('dashboard.sessions'),@@ -2063,6 +2096,187 @@ const ViewProjectContent = () => {}}+ const loadProfiles = async (forcedSkip?: number) => {+ if (profilesLoading) {+ return+ }++ const requestId = profilesRequestIdRef.current+ setProfilesLoading(true)++ try {+ const skip = typeof forcedSkip === 'number' ? forcedSkip : profilesSkip+ let dataProfiles: { profiles: Profile[] }+ let from+ let to++ if (dateRange) {+ from = getFormatDate(dateRange[0])+ to = getFormatDate(dateRange[1])+ }++ if (period === 'custom' && dateRange) {+ dataProfiles = await getProfiles(+ id,+ '',+ filters,+ from,+ to,+ SESSIONS_TAKE,+ skip,+ timezone,+ profileSearch,+ profileTypeFilter,+ projectPassword,+ )+ } else {+ dataProfiles = await getProfiles(+ id,+ period,+ filters,+ '',+ '',+ SESSIONS_TAKE,+ skip,+ timezone,+ profileSearch,+ profileTypeFilter,+ projectPassword,+ )+ }++ if (requestId === profilesRequestIdRef.current) {+ setProfiles((prev) => [...prev, ...(dataProfiles?.profiles || [])])+ setProfilesSkip((prev) => {+ if (typeof forcedSkip === 'number') {+ return SESSIONS_TAKE + forcedSkip+ }+ return SESSIONS_TAKE + prev+ })++ if (dataProfiles?.profiles?.length < SESSIONS_TAKE) {+ setCanLoadMoreProfiles(false)+ } else {+ setCanLoadMoreProfiles(true)+ }+ }+ } catch (reason) {+ console.error('[ERROR](loadProfiles) Loading profiles data failed:', reason)+ } finally {+ if (requestId === profilesRequestIdRef.current) {+ setProfilesLoading(false)+ }+ }+ }++ const loadProfile = async (profileId: string) => {+ setProfileLoading(true)+ setProfileSessions([])+ setProfileSessionsSkip(0)+ setCanLoadMoreProfileSessions(false)++ try {+ let from+ let to++ if (dateRange) {+ from = getFormatDate(dateRange[0])+ to = getFormatDate(dateRange[1])+ }++ const data = await getProfile(+ id,+ profileId,+ period === 'custom' ? '' : period,+ from || '',+ to || '',+ timezone,+ projectPassword,+ )+ setActiveProfile(data)+ // Load initial sessions for the profile+ loadProfileSessionsData(profileId, 0)+ } catch (reason) {+ console.error('[ERROR](loadProfile) Loading profile data failed:', reason)+ setActiveProfile(null)+ } finally {+ setProfileLoading(false)+ }+ }++ const loadProfileSessionsData = async (profileId: string, forcedSkip?: number) => {+ if (profileSessionsLoading) {+ return+ }++ setProfileSessionsLoading(true)++ try {+ const skip = typeof forcedSkip === 'number' ? forcedSkip : profileSessionsSkip+ let dataSessions: { sessions: Session[] }+ let from+ let to++ if (dateRange) {+ from = getFormatDate(dateRange[0])+ to = getFormatDate(dateRange[1])+ }++ if (period === 'custom' && dateRange) {+ dataSessions = await getProfileSessions(+ id,+ profileId,+ '',+ filters,+ from,+ to,+ SESSIONS_TAKE,+ skip,+ timezone,+ projectPassword,+ )+ } else {+ dataSessions = await getProfileSessions(+ id,+ profileId,+ period,+ filters,+ '',+ '',+ SESSIONS_TAKE,+ skip,+ timezone,+ projectPassword,+ )+ }++ setProfileSessions((prev) => [...prev, ...(dataSessions?.sessions || [])])+ setProfileSessionsSkip((prev) => {+ if (typeof forcedSkip === 'number') {+ return SESSIONS_TAKE + forcedSkip+ }+ return SESSIONS_TAKE + prev+ })++ if (dataSessions?.sessions?.length < SESSIONS_TAKE) {+ setCanLoadMoreProfileSessions(false)+ } else {+ setCanLoadMoreProfileSessions(true)+ }+ } catch (reason) {+ console.error('[ERROR](loadProfileSessions) Loading profile sessions failed:', reason)+ } finally {+ setProfileSessionsLoading(false)+ }+ }++ const resetProfiles = () => {+ profilesRequestIdRef.current += 1+ setProfilesSkip(0)+ setProfiles([])+ setCanLoadMoreProfiles(false)+ }+const loadErrors = async (forcedSkip?: number, override?: boolean) => {if (errorsLoading) {return@@ -2543,6 +2757,58 @@ const ViewProjectContent = () => {// eslint-disable-next-line react-hooks/exhaustive-deps}, [activeTab, dateRange, filters, id, period, projectPassword, timezone, authLoading, project, activePSID])+ // Load profiles list when users tab is active+ useEffect(() => {+ if (authLoading || activeTab !== PROJECT_TABS.users || !project || activeProfileId) {+ return+ }++ if (skipNextProfilesAutoLoadRef.current) {+ skipNextProfilesAutoLoadRef.current = false+ return+ }++ loadProfiles()+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [+ activeTab,+ dateRange,+ filters,+ id,+ period,+ projectPassword,+ timezone,+ authLoading,+ project,+ activeProfileId,+ profileTypeFilter,+ profileSearch,+ ])++ // Load single profile when profileId is set+ useEffect(() => {+ if (authLoading || !activeProfileId || !project) {+ return+ }++ loadProfile(activeProfileId)+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [activeProfileId, authLoading, project])++ // Reset profiles when navigating away from profile detail+ useEffect(() => {+ const prevProfileId = prevActiveProfileIdRef.current+ prevActiveProfileIdRef.current = activeProfileId++ if (prevProfileId && !activeProfileId) {+ // We just closed a profile detail, reset to first page+ resetProfiles()+ skipNextProfilesAutoLoadRef.current = true+ loadProfiles(0)+ }+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [activeProfileId])+useEffect(() => {if (authLoading || activeTab !== PROJECT_TABS.errors || authLoading || !project || activeEID) {return@@ -3598,6 +3864,81 @@ const ViewProjectContent = () => {)}</div>) : null}+ {activeTab === PROJECT_TABS.users && !activeProfileId ? (+ <>+ <UsersFilter+ profileType={profileTypeFilter}+ onProfileTypeChange={(type) => {+ setProfileTypeFilter(type)+ resetProfiles()+ }}+ search={profileSearch}+ onSearchChange={(search) => {+ setProfileSearch(search)+ resetProfiles()+ }}+ />+ {(profilesLoading === null || profilesLoading) && _isEmpty(profiles) ? <Loader /> : null}+ {typeof profilesLoading === 'boolean' && !profilesLoading && _isEmpty(profiles) ? (+ <NoEvents filters={filters} />+ ) : null}+ <Users profiles={profiles} timeFormat={timeFormat} />+ {canLoadMoreProfiles ? (+ <button+ type='button'+ title={t('project.loadMore')}+ onClick={() => loadProfiles()}+ className={cx(+ 'relative mx-auto mt-2 flex items-center rounded-md border border-transparent p-2 text-sm font-medium text-gray-700 hover:border-gray-300 hover:bg-white focus:z-10 focus:ring-1 focus:ring-indigo-500 focus:outline-hidden dark:bg-slate-900 dark:text-gray-50 hover:dark:border-slate-700/80 dark:hover:bg-slate-800 focus:dark:ring-gray-200',+ {+ 'cursor-not-allowed opacity-50': profilesLoading || profilesLoading === null,+ hidden: profilesLoading && _isEmpty(profiles),+ },+ )}+ >+ <DownloadIcon className='mr-2 h-5 w-5' strokeWidth={1.5} />+ {t('project.loadMore')}+ </button>+ ) : null}+ </>+ ) : null}+ {activeTab === PROJECT_TABS.users && activeProfileId ? (+ <>+ <div className='mx-auto mt-2 mb-4 flex max-w-max items-center space-x-4 lg:mx-0'>+ <Link+ to={{+ search: (() => {+ const params = new URLSearchParams(searchParams)+ params.delete('profileId')+ return params.toString()+ })(),+ }}+ className='flex items-center text-sm text-gray-900 underline decoration-dashed hover:decoration-solid dark:text-gray-100'+ >+ <ChevronLeftIcon className='mr-1 size-3' />+ {t('project.backToUsers')}+ </Link>+ <RefreshStatsButton onRefresh={() => loadProfile(activeProfileId)} />+ </div>+ {profileLoading ? (+ <Loader />+ ) : (+ <UserDetails+ details={activeProfile}+ sessions={profileSessions}+ sessionsLoading={profileSessionsLoading}+ timeFormat={timeFormat}+ chartType={chartType}+ onLoadMoreSessions={() => {+ if (activeProfileId) {+ loadProfileSessionsData(activeProfileId)+ }+ }}+ canLoadMoreSessions={canLoadMoreProfileSessions}+ />+ )}+ </>+ ) : null}{activeTab === PROJECT_TABS.sessions && !activePSID ? (<>{!_isEmpty(sessions) ? <Filters tnMapping={tnMapping} /> : null}diff --git a/web/app/pages/Project/View/components/UserDetails.tsx b/web/app/pages/Project/View/components/UserDetails.tsxnew file mode 100644index 000000000..e40358383--- /dev/null+++ b/web/app/pages/Project/View/components/UserDetails.tsx@@ -0,0 +1,552 @@+import cx from 'clsx'+import dayjs from 'dayjs'+import _capitalize from 'lodash/capitalize'+import _isEmpty from 'lodash/isEmpty'+import { useMemo } from 'react'+import { useTranslation } from 'react-i18next'+import {+ EyeIcon,+ SparklesIcon,+ ClockIcon,+ CalendarIcon,+ FileTextIcon,+ MonitorIcon,+ SmartphoneIcon,+ TabletIcon,+ GlobeIcon,+} from 'lucide-react'++import { ProfileDetails as ProfileDetailsType, Session } from '~/lib/models/Project'+import { getLocaleDisplayName, getStringFromTime, getTimeFromSeconds } from '~/utils/generic'+import Loader from '~/ui/Loader'++import CCRow from './CCRow'+import { Sessions } from './Sessions'+import { SessionChart } from './SessionChart'++// Generate display names for anonymous users+const ADJECTIVES = [+ 'Amber',+ 'Azure',+ 'Beige',+ 'Black',+ 'Blue',+ 'Bronze',+ 'Brown',+ 'Coral',+ 'Crimson',+ 'Cyan',+ 'Emerald',+ 'Fuchsia',+ 'Gold',+ 'Gray',+ 'Green',+ 'Indigo',+ 'Ivory',+ 'Jade',+ 'Lavender',+ 'Lime',+ 'Magenta',+ 'Maroon',+ 'Mint',+ 'Navy',+ 'Olive',+ 'Orange',+ 'Peach',+ 'Pink',+ 'Plum',+ 'Purple',+ 'Red',+ 'Rose',+ 'Ruby',+ 'Salmon',+ 'Sapphire',+ 'Scarlet',+ 'Silver',+ 'Slate',+ 'Teal',+ 'Turquoise',+ 'Violet',+ 'White',+ 'Yellow',+]++const NOUNS = [+ 'Albatross',+ 'Ant',+ 'Badger',+ 'Bear',+ 'Beaver',+ 'Bison',+ 'Butterfly',+ 'Camel',+ 'Cardinal',+ 'Cat',+ 'Cheetah',+ 'Cobra',+ 'Condor',+ 'Coyote',+ 'Crane',+ 'Crow',+ 'Deer',+ 'Dolphin',+ 'Dove',+ 'Dragon',+ 'Eagle',+ 'Elephant',+ 'Elk',+ 'Falcon',+ 'Ferret',+ 'Finch',+ 'Flamingo',+ 'Fox',+ 'Frog',+ 'Gazelle',+ 'Giraffe',+ 'Goat',+ 'Goose',+ 'Gorilla',+ 'Hamster',+ 'Hare',+ 'Hawk',+ 'Hedgehog',+ 'Heron',+ 'Hippo',+ 'Horse',+ 'Hummingbird',+ 'Hyena',+ 'Iguana',+ 'Jaguar',+ 'Jay',+ 'Kangaroo',+ 'Koala',+ 'Lemur',+ 'Leopard',+ 'Lion',+ 'Llama',+ 'Lobster',+ 'Lynx',+ 'Macaw',+ 'Meerkat',+ 'Mongoose',+ 'Moose',+ 'Moth',+ 'Mouse',+ 'Narwhal',+ 'Newt',+ 'Octopus',+ 'Orca',+ 'Ostrich',+ 'Otter',+ 'Owl',+ 'Panda',+ 'Panther',+ 'Parrot',+ 'Peacock',+ 'Pelican',+ 'Penguin',+ 'Phoenix',+ 'Pig',+ 'Pigeon',+ 'Piranha',+ 'Pony',+ 'Porcupine',+ 'Puma',+ 'Quail',+ 'Rabbit',+ 'Raccoon',+ 'Raven',+ 'Rhino',+ 'Robin',+ 'Salamander',+ 'Salmon',+ 'Seal',+ 'Shark',+ 'Sheep',+ 'Sloth',+ 'Snail',+ 'Snake',+ 'Sparrow',+ 'Spider',+ 'Squirrel',+ 'Stork',+ 'Swan',+ 'Tiger',+ 'Toucan',+ 'Trout',+ 'Turtle',+ 'Viper',+ 'Vulture',+ 'Walrus',+ 'Weasel',+ 'Whale',+ 'Wolf',+ 'Wombat',+ 'Woodpecker',+ 'Yak',+ 'Zebra',+]++const generateDisplayName = (profileId: string): string => {+ let hash = 0+ for (let i = 0; i < profileId.length; i++) {+ const char = profileId.charCodeAt(i)+ hash = (hash << 5) - hash + char+ hash = hash & hash+ }+ hash = Math.abs(hash)+ const adjIndex = hash % ADJECTIVES.length+ const nounIndex = Math.floor(hash / ADJECTIVES.length) % NOUNS.length+ return `${ADJECTIVES[adjIndex]} ${NOUNS[nounIndex]}`+}++interface UserDetailsProps {+ details: ProfileDetailsType | null+ sessions: Session[]+ sessionsLoading: boolean | null+ timeFormat: '12-hour' | '24-hour'+ chartType: string+ onLoadMoreSessions: () => void+ canLoadMoreSessions: boolean+}++// Activity Calendar Component+const ActivityCalendar = ({ data }: { data: { date: string; count: number }[] }) => {+ const { t } = useTranslation('common')++ const countMap = useMemo(() => {+ const map = new Map<string, number>()+ data.forEach((item) => map.set(item.date, item.count))+ return map+ }, [data])++ const weeks = useMemo(() => {+ const result: { date: string; count: number }[][] = []+ const now = dayjs()+ const startDate = now.subtract(4, 'month').startOf('week')+ const endDate = now.endOf('week')++ let currentWeek: { date: string; count: number }[] = []+ let currentDay = startDate++ while (currentDay.isBefore(endDate) || currentDay.isSame(endDate, 'day')) {+ const dateStr = currentDay.format('YYYY-MM-DD')+ currentWeek.push({ date: dateStr, count: countMap.get(dateStr) || 0 })+ if (currentWeek.length === 7) {+ result.push(currentWeek)+ currentWeek = []+ }+ currentDay = currentDay.add(1, 'day')+ }+ if (currentWeek.length > 0) result.push(currentWeek)+ return result+ }, [countMap])++ const monthLabels = useMemo(() => {+ const labels: { month: string; weekIndex: number }[] = []+ let lastMonth = ''+ weeks.forEach((week, weekIndex) => {+ const firstDay = dayjs(week[0].date)+ const month = firstDay.format('MMM')+ if (month !== lastMonth) {+ labels.push({ month, weekIndex })+ lastMonth = month+ }+ })+ return labels+ }, [weeks])++ const getColor = (count: number) => {+ if (count === 0) return 'bg-gray-100 dark:bg-slate-700/50'+ if (count <= 2) return 'bg-emerald-200 dark:bg-emerald-800'+ if (count <= 5) return 'bg-emerald-300 dark:bg-emerald-700'+ if (count <= 10) return 'bg-emerald-400 dark:bg-emerald-600'+ return 'bg-emerald-500'+ }++ return (+ <div className='overflow-x-auto'>+ <div className='mb-1 flex text-[10px] text-gray-400' style={{ marginLeft: '14px' }}>+ {monthLabels.map(({ month, weekIndex }, idx) => (+ <span+ key={idx}+ style={{+ marginLeft:+ weekIndex === 0 ? 0 : `${(weekIndex - (idx > 0 ? monthLabels[idx - 1].weekIndex : 0)) * 10}px`,+ }}+ >+ {month}+ </span>+ ))}+ </div>+ <div className='flex gap-[2px]'>+ <div className='flex flex-col gap-[2px] pr-1 text-[9px] text-gray-400'>+ {['', 'M', '', 'W', '', 'F', ''].map((d, i) => (+ <span key={i} className='h-2 leading-2'>+ {d}+ </span>+ ))}+ </div>+ {weeks.map((week, weekIdx) => (+ <div key={weekIdx} className='flex flex-col gap-[2px]'>+ {week.map((day, dayIdx) => (+ <div+ key={dayIdx}+ className={cx('h-2 w-2 rounded-[2px]', getColor(day.count))}+ title={`${day.date}: ${day.count} ${t('dashboard.pageviews').toLowerCase()}`}+ />+ ))}+ </div>+ ))}+ </div>+ </div>+ )+}++// Stat Item Component+const StatItem = ({ icon, label, value }: { icon: React.ReactNode; label: string; value: string | number }) => (+ <div>+ <div className='mb-0.5 flex items-center gap-1.5 text-[10px] font-medium tracking-wide text-gray-400 uppercase'>+ {icon}+ {label}+ </div>+ <div className='text-lg font-semibold text-gray-900 dark:text-white'>{value}</div>+ </div>+)++// Info Row Component for Location & Device+const InfoRow = ({ label, value }: { label: string; value: React.ReactNode }) => (+ <div className='flex items-center justify-between border-b border-gray-100 py-2 last:border-0 dark:border-slate-700/50'>+ <span className='text-sm text-gray-500 dark:text-gray-400'>{label}</span>+ <span className='flex items-center gap-1.5 text-sm font-medium text-gray-900 dark:text-white'>{value}</span>+ </div>+)++// Device Icon Component+const DeviceIcon = ({ device }: { device: string | null }) => {+ const deviceLower = device?.toLowerCase() || ''+ if (deviceLower === 'mobile') return <SmartphoneIcon className='h-4 w-4' />+ if (deviceLower === 'tablet') return <TabletIcon className='h-4 w-4' />+ return <MonitorIcon className='h-4 w-4' />+}++// Browser Icon Component (simplified - using globe as fallback)+const BrowserIcon = ({ browser }: { browser: string | null }) => {+ // Could add specific browser icons here+ return <GlobeIcon className='h-4 w-4' />+}++export const UserDetails = ({+ details,+ sessions,+ sessionsLoading,+ timeFormat,+ chartType,+ onLoadMoreSessions,+ canLoadMoreSessions,+}: UserDetailsProps) => {+ const {+ t,+ i18n: { language },+ } = useTranslation('common')++ const displayName = useMemo(() => {+ if (!details) return ''+ if (details.isIdentified) {+ const userId = details.profileId.replace('usr_', '')+ return userId.length <= 20 ? userId : `${userId.substring(0, 17)}...`+ }+ return generateDisplayName(details.profileId)+ }, [details])++ const avatarColor = useMemo(() => {+ if (!details) return 'hsl(0, 0%, 50%)'+ let hash = 0+ for (let i = 0; i < details.profileId.length; i++) {+ hash = details.profileId.charCodeAt(i) + ((hash << 5) - hash)+ }+ return `hsl(${Math.abs(hash) % 360}, 55%, 50%)`+ }, [details])++ const formatDate = (date: string | undefined) => {+ if (!date) return 'N/A'+ return dayjs(date).format('MMM D, YYYY')+ }++ const dataNames = useMemo(+ () => ({+ pageviews: t('dashboard.pageviews'),+ customEvents: t('dashboard.events'),+ errors: t('dashboard.errors'),+ }),+ [t],+ )++ if (!details) return <Loader />++ const avgDurationStr = details.avgDuration ? getStringFromTime(getTimeFromSeconds(details.avgDuration)) : 'N/A'++ return (+ <div className='space-y-6'>+ {/* Header */}+ <div className='flex items-center gap-4'>+ <div+ className='flex h-14 w-14 shrink-0 items-center justify-center rounded-full text-2xl'+ style={{ backgroundColor: avatarColor }}+ >+ <span className='text-white'>:)</span>+ </div>+ <div>+ <h2 className='text-2xl font-bold text-gray-900 dark:text-white'>{displayName}</h2>+ <code className='text-sm text-gray-400'>{details.profileId.substring(0, 12)}</code>+ </div>+ </div>++ {/* Main Content - Two Column Layout */}+ <div className='flex flex-col gap-6 lg:flex-row'>+ {/* Left Column - Stats & Location/Device & Activity Calendar */}+ <div className='space-y-4 lg:w-[380px]'>+ {/* Stats Card */}+ <div className='rounded-xl border border-gray-200 bg-white p-5 dark:border-slate-700 dark:bg-slate-800'>+ <div className='grid grid-cols-2 gap-y-5'>+ <StatItem+ icon={<FileTextIcon className='h-3.5 w-3.5' />}+ label={t('project.sessions')}+ value={details.sessionsCount || 0}+ />+ <StatItem+ icon={<EyeIcon className='h-3.5 w-3.5' />}+ label={t('dashboard.pageviews')}+ value={details.pageviewsCount || 0}+ />+ <StatItem+ icon={<SparklesIcon className='h-3.5 w-3.5' />}+ label={t('dashboard.events')}+ value={details.eventsCount || 0}+ />+ <StatItem+ icon={<ClockIcon className='h-3.5 w-3.5' />}+ label={t('project.avgDuration')}+ value={avgDurationStr}+ />+ <StatItem+ icon={<CalendarIcon className='h-3.5 w-3.5' />}+ label={t('project.firstSeen')}+ value={formatDate(details.firstSeen)}+ />+ <StatItem+ icon={<CalendarIcon className='h-3.5 w-3.5' />}+ label={t('project.lastSeen')}+ value={formatDate(details.lastSeen)}+ />+ </div>+ </div>++ {/* Location & Device Card */}+ <div className='rounded-xl border border-gray-200 bg-white p-5 dark:border-slate-700 dark:bg-slate-800'>+ <h3 className='mb-3 text-xs font-semibold tracking-wide text-gray-500 uppercase dark:text-gray-400'>+ {t('project.locationAndDevice')}+ </h3>+ <div>+ <InfoRow+ label={t('project.mapping.cc')}+ value={details.cc ? <CCRow size={16} cc={details.cc} language={language} /> : '-'}+ />+ {details.rg && <InfoRow label={t('project.mapping.rg')} value={details.rg} />}+ <InfoRow+ label={t('project.mapping.lc')}+ value={details.lc ? getLocaleDisplayName(details.lc, language) : '-'}+ />+ <InfoRow+ label={t('project.mapping.dv')}+ value={+ details.dv ? (+ <>+ <DeviceIcon device={details.dv} />+ {_capitalize(details.dv)}+ </>+ ) : (+ '-'+ )+ }+ />+ <InfoRow+ label={t('project.mapping.br')}+ value={+ details.br ? (+ <>+ <BrowserIcon browser={details.br} />+ {details.br}+ {details.brv ? ` v${details.brv}` : ''}+ </>+ ) : (+ '-'+ )+ }+ />+ <InfoRow+ label={t('project.mapping.os')}+ value={details.os ? `${details.os}${details.osv ? ` v${details.osv}` : ''}` : '-'}+ />+ </div>+ </div>++ {/* Activity Calendar Card */}+ <div className='rounded-xl border border-gray-200 bg-white p-5 dark:border-slate-700 dark:bg-slate-800'>+ <h3 className='mb-4 text-xs font-semibold tracking-wide text-gray-500 uppercase dark:text-gray-400'>+ {t('project.activityCalendar')}+ </h3>+ <ActivityCalendar data={details.activityCalendar || []} />+ </div>+ </div>++ {/* Right Column - Chart */}+ <div className='flex-1'>+ {details.chart && !_isEmpty(details.chart.x) && (+ <div className='h-full rounded-xl border border-gray-200 bg-white p-5 dark:border-slate-700 dark:bg-slate-800'>+ <h3 className='mb-4 text-base font-semibold text-gray-900 dark:text-white'>{t('dashboard.pageviews')}</h3>+ <SessionChart+ chart={details.chart}+ timeBucket={details.timeBucket}+ timeFormat={timeFormat}+ rotateXAxis={false}+ chartType={chartType}+ dataNames={dataNames}+ className='h-[300px] [&_svg]:overflow-visible!'+ />+ </div>+ )}+ </div>+ </div>++ {/* Sessions - Full Width */}+ <div className='rounded-xl border border-gray-200 bg-white p-5 dark:border-slate-700 dark:bg-slate-800'>+ <h3 className='mb-3 text-xs font-semibold tracking-wide text-gray-500 uppercase dark:text-gray-400'>+ {t('project.userSessions')}+ </h3>+ {sessionsLoading && sessions.length === 0 ? (+ <Loader />+ ) : sessions.length === 0 ? (+ <p className='py-4 text-center text-sm text-gray-400'>{t('project.noSessions')}</p>+ ) : (+ <>+ <Sessions sessions={sessions} timeFormat={timeFormat} />+ {canLoadMoreSessions && (+ <button+ type='button'+ onClick={onLoadMoreSessions}+ disabled={!!sessionsLoading}+ className={cx(+ 'mt-4 w-full rounded-lg border border-gray-200 bg-gray-50 px-4 py-2.5 text-sm font-medium text-gray-700 transition-colors hover:bg-gray-100 dark:border-slate-600 dark:bg-slate-700 dark:text-gray-200 dark:hover:bg-slate-600',+ sessionsLoading && 'cursor-not-allowed opacity-50',+ )}+ >+ {t('project.loadMore')}+ </button>+ )}+ </>+ )}+ </div>+ </div>+ )+}diff --git a/web/app/pages/Project/View/components/Users.tsx b/web/app/pages/Project/View/components/Users.tsxnew file mode 100644index 000000000..04803dd51--- /dev/null+++ b/web/app/pages/Project/View/components/Users.tsx@@ -0,0 +1,424 @@+import { ChevronRightIcon } from '@heroicons/react/24/outline'+import dayjs from 'dayjs'+import relativeTime from 'dayjs/plugin/relativeTime'+import _map from 'lodash/map'+import { FileTextIcon, MousePointerClickIcon, UserIcon, UsersIcon, CalendarIcon } from 'lucide-react'+import React, { useMemo } from 'react'+import { useTranslation } from 'react-i18next'+import { Link, useLocation } from 'react-router'+import { ClientOnly } from 'remix-utils/client-only'++import { Profile as ProfileType } from '~/lib/models/Project'+import Loader from '~/ui/Loader'++import CCRow from './CCRow'++dayjs.extend(relativeTime)++// Adjectives and nouns for generating anonymous display names+const ADJECTIVES = [+ 'Amber',+ 'Azure',+ 'Beige',+ 'Black',+ 'Blue',+ 'Bronze',+ 'Brown',+ 'Coral',+ 'Crimson',+ 'Cyan',+ 'Emerald',+ 'Fuchsia',+ 'Gold',+ 'Gray',+ 'Green',+ 'Indigo',+ 'Ivory',+ 'Jade',+ 'Lavender',+ 'Lime',+ 'Magenta',+ 'Maroon',+ 'Mint',+ 'Navy',+ 'Olive',+ 'Orange',+ 'Peach',+ 'Pink',+ 'Plum',+ 'Purple',+ 'Red',+ 'Rose',+ 'Ruby',+ 'Salmon',+ 'Sapphire',+ 'Scarlet',+ 'Silver',+ 'Slate',+ 'Teal',+ 'Turquoise',+ 'Violet',+ 'White',+ 'Yellow',+]++const NOUNS = [+ 'Albatross',+ 'Ant',+ 'Badger',+ 'Bear',+ 'Beaver',+ 'Bison',+ 'Butterfly',+ 'Camel',+ 'Cardinal',+ 'Cat',+ 'Cheetah',+ 'Cobra',+ 'Condor',+ 'Coyote',+ 'Crane',+ 'Crow',+ 'Deer',+ 'Dolphin',+ 'Dove',+ 'Dragon',+ 'Eagle',+ 'Elephant',+ 'Elk',+ 'Falcon',+ 'Ferret',+ 'Finch',+ 'Flamingo',+ 'Fox',+ 'Frog',+ 'Gazelle',+ 'Giraffe',+ 'Goat',+ 'Goose',+ 'Gorilla',+ 'Hamster',+ 'Hare',+ 'Hawk',+ 'Hedgehog',+ 'Heron',+ 'Hippo',+ 'Horse',+ 'Hummingbird',+ 'Hyena',+ 'Iguana',+ 'Jaguar',+ 'Jay',+ 'Kangaroo',+ 'Koala',+ 'Lemur',+ 'Leopard',+ 'Lion',+ 'Llama',+ 'Lobster',+ 'Lynx',+ 'Macaw',+ 'Meerkat',+ 'Mongoose',+ 'Moose',+ 'Moth',+ 'Mouse',+ 'Narwhal',+ 'Newt',+ 'Octopus',+ 'Orca',+ 'Ostrich',+ 'Otter',+ 'Owl',+ 'Panda',+ 'Panther',+ 'Parrot',+ 'Peacock',+ 'Pelican',+ 'Penguin',+ 'Phoenix',+ 'Pig',+ 'Pigeon',+ 'Piranha',+ 'Pony',+ 'Porcupine',+ 'Puma',+ 'Quail',+ 'Rabbit',+ 'Raccoon',+ 'Raven',+ 'Rhino',+ 'Robin',+ 'Salamander',+ 'Salmon',+ 'Seal',+ 'Shark',+ 'Sheep',+ 'Sloth',+ 'Snail',+ 'Snake',+ 'Sparrow',+ 'Spider',+ 'Squirrel',+ 'Stork',+ 'Swan',+ 'Tiger',+ 'Toucan',+ 'Trout',+ 'Turtle',+ 'Viper',+ 'Vulture',+ 'Walrus',+ 'Weasel',+ 'Whale',+ 'Wolf',+ 'Wombat',+ 'Woodpecker',+ 'Yak',+ 'Zebra',+]++// Generate a deterministic display name from profileId+const generateDisplayName = (profileId: string): string => {+ // Simple hash function+ let hash = 0+ for (let i = 0; i < profileId.length; i++) {+ const char = profileId.charCodeAt(i)+ hash = (hash << 5) - hash + char+ hash = hash & hash // Convert to 32bit integer+ }+ hash = Math.abs(hash)++ const adjIndex = hash % ADJECTIVES.length+ const nounIndex = Math.floor(hash / ADJECTIVES.length) % NOUNS.length++ return `${ADJECTIVES[adjIndex]} ${NOUNS[nounIndex]}`+}++interface UsersProps {+ profiles: ProfileType[]+ timeFormat: '12-hour' | '24-hour'+}++interface UserRowProps {+ profile: ProfileType+ timeFormat: '12-hour' | '24-hour'+}++const Separator = () => (+ <svg viewBox='0 0 2 2' className='h-0.5 w-0.5 flex-none fill-gray-400'>+ <circle cx={1} cy={1} r={1} />+ </svg>+)++const UserRow = ({ profile, timeFormat }: UserRowProps) => {+ const {+ t,+ i18n: { language },+ } = useTranslation('common')+ const location = useLocation()++ const displayName = useMemo(() => {+ if (profile.isIdentified) {+ // For identified users, extract the user ID from the profileId+ const userId = profile.profileId.replace('usr_', '')+ // If it's a short enough ID, show it directly+ if (userId.length <= 20) {+ return userId+ }+ // Otherwise truncate it+ return `${userId.substring(0, 17)}...`+ }+ return generateDisplayName(profile.profileId)+ }, [profile.profileId, profile.isIdentified])++ const lastSeenText = useMemo(() => {+ return dayjs(profile.lastSeen)+ .toDate()+ .toLocaleDateString(language, {+ day: 'numeric',+ month: 'short',+ year: 'numeric',+ hour: 'numeric',+ minute: 'numeric',+ hourCycle: timeFormat === '12-hour' ? 'h12' : 'h23',+ })+ }, [profile.lastSeen, language, timeFormat])++ const firstSeenText = useMemo(() => {+ return dayjs(profile.firstSeen).toDate().toLocaleDateString(language, {+ day: 'numeric',+ month: 'short',+ year: 'numeric',+ })+ }, [profile.firstSeen, language])++ const params = new URLSearchParams(location.search)+ params.set('profileId', profile.profileId)++ // Generate avatar background color from profileId+ const avatarColor = useMemo(() => {+ let hash = 0+ for (let i = 0; i < profile.profileId.length; i++) {+ hash = profile.profileId.charCodeAt(i) + ((hash << 5) - hash)+ }+ const hue = Math.abs(hash) % 360+ return `hsl(${hue}, 65%, 55%)`+ }, [profile.profileId])++ return (+ <Link to={{ search: params.toString() }}>+ <li className='relative mb-3 flex cursor-pointer justify-between gap-x-6 overflow-hidden rounded-xl border border-gray-200 bg-gray-50 px-4 py-4 transition-colors hover:bg-gray-200/70 sm:px-6 dark:border-slate-800/25 dark:bg-slate-800/70 dark:hover:bg-slate-700/60'>+ <div className='flex min-w-0 gap-x-4'>+ {/* Avatar */}+ <div+ className='flex h-10 w-10 shrink-0 items-center justify-center rounded-full text-sm font-semibold text-white'+ style={{ backgroundColor: avatarColor }}+ >+ {profile.isIdentified ? <UserIcon className='h-5 w-5' /> : displayName.charAt(0)}+ </div>++ <div className='min-w-0 flex-auto'>+ <p className='flex items-center text-sm leading-6 font-semibold text-gray-900 dark:text-gray-50'>+ <span className='truncate'>{displayName}</span>+ {profile.isIdentified ? (+ <span className='ml-2 inline-flex items-center rounded-full bg-indigo-100 px-2 py-0.5 text-xs font-medium text-indigo-700 dark:bg-indigo-900/50 dark:text-indigo-300'>+ {t('project.identified')}+ </span>+ ) : null}+ </p>+ <p className='mt-1 flex flex-wrap items-center gap-x-2 text-xs leading-5 text-gray-500 dark:text-gray-300'>+ <span className='flex'>+ {profile.cc ? <CCRow size={18} cc={profile.cc} language={language} /> : t('project.unknownCountry')}+ </span>+ <Separator />+ {profile.os || t('project.unknown')}+ <Separator />+ {profile.br || t('project.unknown')}+ </p>+ <p className='mt-2 flex text-xs leading-5 text-gray-500 sm:hidden dark:text-gray-300'>+ <span className='mr-2 flex items-center' title={t('project.sessions')}>+ <UsersIcon className='mr-1 size-4' strokeWidth={1.5} /> {profile.sessionsCount}+ </span>+ <span className='mr-2 flex items-center' title={t('dashboard.pageviews')}>+ <FileTextIcon className='mr-1 size-4' strokeWidth={1.5} /> {profile.pageviewsCount}+ </span>+ {profile.eventsCount > 0 ? (+ <span className='flex items-center' title={t('dashboard.events')}>+ <MousePointerClickIcon className='mr-1 size-4' strokeWidth={1.5} /> {profile.eventsCount}+ </span>+ ) : null}+ </p>+ </div>+ </div>+ <div className='flex shrink-0 items-center gap-x-4'>+ <div className='hidden sm:flex sm:flex-col sm:items-end'>+ <div className='flex items-center gap-x-3 text-sm leading-6 text-gray-900 dark:text-gray-50'>+ <span className='flex items-center' title={t('project.xSessions', { x: profile.sessionsCount })}>+ <UsersIcon className='mr-1 size-5' strokeWidth={1.5} /> {profile.sessionsCount}+ </span>+ <span className='flex items-center' title={t('dashboard.xPageviews', { x: profile.pageviewsCount })}>+ <FileTextIcon className='mr-1 size-5' strokeWidth={1.5} /> {profile.pageviewsCount}+ </span>+ {profile.eventsCount > 0 ? (+ <span className='flex items-center' title={t('dashboard.xCustomEvents', { x: profile.eventsCount })}>+ <MousePointerClickIcon className='mr-1 size-5' strokeWidth={1.5} /> {profile.eventsCount}+ </span>+ ) : null}+ </div>+ <p className='mt-1 flex items-center text-xs leading-5 text-gray-500 dark:text-gray-400'>+ <CalendarIcon className='mr-1 size-3' strokeWidth={1.5} />+ {lastSeenText}+ </p>+ </div>+ <ChevronRightIcon className='h-5 w-5 flex-none text-gray-400' aria-hidden='true' />+ </div>+ </li>+ </Link>+ )+}++interface UsersFilterProps {+ profileType: 'all' | 'anonymous' | 'identified'+ onProfileTypeChange: (type: 'all' | 'anonymous' | 'identified') => void+ search: string+ onSearchChange: (search: string) => void+}++export const UsersFilter: React.FC<UsersFilterProps> = ({+ profileType,+ onProfileTypeChange,+ search,+ onSearchChange,+}) => {+ const { t } = useTranslation('common')++ return (+ <div className='mb-4 flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between'>+ <div className='flex items-center gap-2'>+ <button+ type='button'+ onClick={() => onProfileTypeChange('all')}+ className={`rounded-md px-3 py-1.5 text-sm font-medium transition-colors ${+ profileType === 'all'+ ? 'bg-indigo-600 text-white'+ : 'bg-gray-100 text-gray-700 hover:bg-gray-200 dark:bg-slate-700 dark:text-gray-300 dark:hover:bg-slate-600'+ }`}+ >+ {t('project.allUsers')}+ </button>+ <button+ type='button'+ onClick={() => onProfileTypeChange('anonymous')}+ className={`rounded-md px-3 py-1.5 text-sm font-medium transition-colors ${+ profileType === 'anonymous'+ ? 'bg-indigo-600 text-white'+ : 'bg-gray-100 text-gray-700 hover:bg-gray-200 dark:bg-slate-700 dark:text-gray-300 dark:hover:bg-slate-600'+ }`}+ >+ {t('project.anonymous')}+ </button>+ <button+ type='button'+ onClick={() => onProfileTypeChange('identified')}+ className={`rounded-md px-3 py-1.5 text-sm font-medium transition-colors ${+ profileType === 'identified'+ ? 'bg-indigo-600 text-white'+ : 'bg-gray-100 text-gray-700 hover:bg-gray-200 dark:bg-slate-700 dark:text-gray-300 dark:hover:bg-slate-600'+ }`}+ >+ {t('project.identified')}+ </button>+ </div>+ <div className='relative'>+ <input+ type='text'+ value={search}+ onChange={(e) => onSearchChange(e.target.value)}+ placeholder={t('project.searchUsers')}+ className='block w-full rounded-md border border-gray-300 bg-white px-3 py-1.5 text-sm text-gray-900 placeholder-gray-500 focus:border-indigo-500 focus:ring-1 focus:ring-indigo-500 sm:w-64 dark:border-slate-600 dark:bg-slate-800 dark:text-gray-100 dark:placeholder-gray-400'+ />+ </div>+ </div>+ )+}++export const Users: React.FC<UsersProps> = ({ profiles, timeFormat }) => {+ return (+ <ClientOnly+ fallback={+ <div className='bg-gray-50 dark:bg-slate-900'>+ <Loader />+ </div>+ }+ >+ {() => (+ <ul className='mt-4'>+ {_map(profiles, (profile) => (+ <UserRow key={profile.profileId} profile={profile} timeFormat={timeFormat} />+ ))}+ </ul>+ )}+ </ClientOnly>+ )+}diff --git a/web/public/locales/en.json b/web/public/locales/en.jsonindex 123dd76eb..f9ee88c43 100644--- a/web/public/locales/en.json+++ b/web/public/locales/en.json@@ -826,6 +826,7 @@"cumulativeMode": "Cumulative mode","traffic": "Traffic","performance": "Performance",+ "users": "Users","funnels": "Funnels","sessions": "Sessions","xOccurrences": "{{x}} occurrences",@@ -833,6 +834,7 @@"xPageviews": "{{x}} pageviews","xCustomEvents": "{{x}} custom events","xErrors": "{{x}} errors",+ "events": "Events","alerts": "Alerts","alertsDesc": "Automated alerts is a powerful tool that notifies you when some events occur on your website.\nWe can automatically monitor your project for traffic spikes and notify you via Telegram, Slack or Discord.","funnelsDesc": "Funnels is a powerful tool that allows you to track the conversion rate of your users through a series of steps.\nThe analysis provided by the marketing funnel gives you the ability to discover potential problems, improve your website, and boost your conversion rate.",@@ -1009,6 +1011,23 @@"trendlineUnique": "Unique visitors trendline","backToFunnels": "Back to funnels list","backToSessions": "Back to sessions list",+ "backToUsers": "Back to users list",+ "allUsers": "All",+ "anonymous": "Anonymous",+ "identified": "Identified",+ "searchUsers": "Search users...",+ "sessions": "Sessions",+ "xSessions": "{{x}} sessions",+ "avgDuration": "Avg. duration",+ "firstSeen": "First seen",+ "lastSeen": "Last seen",+ "activityCalendar": "Activity calendar",+ "topPages": "Top pages",+ "locationAndDevice": "Location & Device",+ "userSessions": "Sessions",+ "noSessions": "No sessions found for this user.",+ "noData": "No data available",+ "unknown": "Unknown","backToErrors": "Back to errors list","occurrences": "Occurrences","visitPage": "Visit {{page}}",