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!

visitors -> profiles

Blue Mouse9394bfebcd47
diff --git a/backend/apps/cloud/src/feature-flag/dto/feature-flag.dto.ts b/backend/apps/cloud/src/feature-flag/dto/feature-flag.dto.ts
index 5103e5019..724b50fd9 100644
--- a/backend/apps/cloud/src/feature-flag/dto/feature-flag.dto.ts
+++ b/backend/apps/cloud/src/feature-flag/dto/feature-flag.dto.ts
@@ -196,8 +196,8 @@ export class FeatureFlagStatsDto {
@ApiProperty({ description: 'Total number of evaluations' })
evaluations: number
- @ApiProperty({ description: 'Number of unique visitors' })
- uniqueVisitors: number
+ @ApiProperty({ description: 'Number of unique profiles' })
+ profileCount: number
@ApiProperty({ description: 'Number of times flag returned true' })
trueCount: number
diff --git a/backend/apps/cloud/src/feature-flag/feature-flag.controller.ts b/backend/apps/cloud/src/feature-flag/feature-flag.controller.ts
index a9719dcdf..e282718aa 100644
--- a/backend/apps/cloud/src/feature-flag/feature-flag.controller.ts
+++ b/backend/apps/cloud/src/feature-flag/feature-flag.controller.ts
@@ -340,13 +340,12 @@ export class FeatureFlagController {
const now = new Date().toISOString().slice(0, 19).replace('T', ' ')
- // Note: The ClickHouse column is named 'visitorId' but we store the profileId value in it
const values = flags.map(flag => ({
pid,
flagId: flag.id,
flagKey: flag.key,
result: evaluatedFlags[flag.key] ? 1 : 0,
- visitorId: profileId,
+ profileId,
created: now,
}))
@@ -490,7 +489,7 @@ export class FeatureFlagController {
const statsQuery = `
SELECT
count(*) as evaluations,
- uniqExact(visitorId) as uniqueVisitors,
+ uniqExact(profileId) as profileCount,
countIf(result = 1) as trueCount,
countIf(result = 0) as falseCount
FROM feature_flag_evaluations
@@ -513,7 +512,7 @@ export class FeatureFlagController {
.then(resultSet =>
resultSet.json<{
evaluations: number
- uniqueVisitors: number
+ profileCount: number
trueCount: number
falseCount: number
}>(),
@@ -521,7 +520,7 @@ export class FeatureFlagController {
const stats = data[0] || {
evaluations: 0,
- uniqueVisitors: 0,
+ profileCount: 0,
trueCount: 0,
falseCount: 0,
}
@@ -533,7 +532,7 @@ export class FeatureFlagController {
return {
evaluations: stats.evaluations,
- uniqueVisitors: stats.uniqueVisitors,
+ profileCount: stats.profileCount,
trueCount: stats.trueCount,
falseCount: stats.falseCount,
truePercentage,
@@ -543,7 +542,7 @@ export class FeatureFlagController {
this.logger.warn({ err }, 'Failed to get flag stats')
return {
evaluations: 0,
- uniqueVisitors: 0,
+ profileCount: 0,
trueCount: 0,
falseCount: 0,
truePercentage: 0,
diff --git a/backend/migrations/clickhouse/2025_12_08_feature_flags.js b/backend/migrations/clickhouse/2025_12_08_feature_flags.js
index 3cc80748c..cd1ae6a16 100644
--- a/backend/migrations/clickhouse/2025_12_08_feature_flags.js
+++ b/backend/migrations/clickhouse/2025_12_08_feature_flags.js
@@ -8,7 +8,7 @@ const queries = [
flagId String,
flagKey String,
result UInt8,
- visitorId String,
+ profileId String,
created DateTime('UTC')
)
ENGINE = MergeTree()
diff --git a/web/app/api/index.ts b/web/app/api/index.ts
index e09d51da0..ed40a5462 100644
--- a/web/app/api/index.ts
+++ b/web/app/api/index.ts
@@ -1267,7 +1267,7 @@ export interface ProjectFeatureFlag {
export interface FeatureFlagStats {
evaluations: number
- uniqueVisitors: number
+ profileCount: number
trueCount: number
falseCount: number
truePercentage: number
diff --git a/web/app/pages/Project/FeatureFlags/View/FeatureFlagSettingsModal.tsx b/web/app/pages/Project/FeatureFlags/View/FeatureFlagSettingsModal.tsx
index 29f9e1710..f4bbda189 100644
--- a/web/app/pages/Project/FeatureFlags/View/FeatureFlagSettingsModal.tsx
+++ b/web/app/pages/Project/FeatureFlags/View/FeatureFlagSettingsModal.tsx
@@ -265,7 +265,7 @@ const response = await fetch('https://api.swetrix.com/feature-flag/evaluate', {
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
pid: '${projectId}',
- visitorId: 'user-123',
+ profileId: 'user-123',
attributes: { cc: 'US', dv: 'desktop' }
})
})
diff --git a/web/app/pages/Project/FeatureFlags/View/FeatureFlagsView.tsx b/web/app/pages/Project/FeatureFlags/View/FeatureFlagsView.tsx
index 2fb60e565..fd65865a7 100644
--- a/web/app/pages/Project/FeatureFlags/View/FeatureFlagsView.tsx
+++ b/web/app/pages/Project/FeatureFlags/View/FeatureFlagsView.tsx
@@ -2,7 +2,6 @@ import { XCircleIcon } from '@heroicons/react/24/outline'
import cx from 'clsx'
import _isEmpty from 'lodash/isEmpty'
import _map from 'lodash/map'
-import _size from 'lodash/size'
import {
FlagIcon,
Trash2Icon,
@@ -118,7 +117,7 @@ const FeatureFlagRow = ({ flag, stats, statsLoading, onDelete, onEdit, onToggle
</span>
<span className='flex items-center gap-1'>
<UsersIcon className='size-3' />
- {nFormatter(stats.uniqueVisitors, 1)}
+ {nFormatter(stats.profileCount, 1)}
</span>
</>
) : (
@@ -148,10 +147,10 @@ const FeatureFlagRow = ({ flag, stats, statsLoading, onDelete, onEdit, onToggle
</div>
<div className='text-right'>
<Text as='p' size='sm' weight='semibold'>
- {nFormatter(stats.uniqueVisitors, 1)}
+ {nFormatter(stats.profileCount, 1)}
</Text>
<Text as='p' size='xs' colour='muted'>
- {t('featureFlags.visitors')}
+ {t('featureFlags.users')}
</Text>
</div>
<div className='text-right'>
diff --git a/web/public/locales/en.json b/web/public/locales/en.json
index 4b06a6f8e..47c3d63fb 100644
--- a/web/public/locales/en.json
+++ b/web/public/locales/en.json
@@ -1043,7 +1043,7 @@
"flagEnabled": "Feature flag enabled",
"flagDisabled": "Feature flag disabled",
"evaluations": "Evaluations",
- "visitors": "Visitors",
+ "users": "Users",
"trueRate": "True rate",
"noStats": "No data yet",
"targetingRulesCount": "{{count}} targeting rule(s)",