Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

Added browser / os versions to session details view

Blue Mouse1a6d78f239cb
diff --git a/backend/apps/production/src/analytics/analytics.service.ts b/backend/apps/production/src/analytics/analytics.service.ts
index e18ce68ba..f3b00b30d 100644
--- a/backend/apps/production/src/analytics/analytics.service.ts
+++ b/backend/apps/production/src/analytics/analytics.service.ts
@@ -3552,48 +3552,48 @@ export class AnalyticsService {
const queryPages = `
WITH events_with_meta AS (
SELECT
- 'pageview' AS type,
- pg AS value,
- toTimeZone(analytics.created, '${safeTimezone}') AS created,
- pid,
- psid,
- groupArrayIf(tuple(meta.key, meta.value), notEmpty(meta.key) AND notEmpty(meta.value)) AS metadata
+ 'pageview' AS type,
+ pg AS value,
+ toTimeZone(analytics.created, '${safeTimezone}') AS created,
+ pid,
+ psid,
+ groupArrayIf(tuple(meta.key, meta.value), notEmpty(meta.key) AND notEmpty(meta.value)) AS metadata
FROM analytics
LEFT ARRAY JOIN meta.key, meta.value
WHERE
- pid = {pid:FixedString(12)}
- AND psid = {psid:String}
+ pid = {pid:FixedString(12)}
+ AND psid = {psid:String}
GROUP BY type, value, created, pid, psid
UNION ALL
SELECT
- 'event' AS type,
- ev AS value,
- toTimeZone(customEV.created, '${safeTimezone}') AS created,
- pid,
- psid,
- groupArrayIf(tuple(meta.key, meta.value), notEmpty(meta.key) AND notEmpty(meta.value)) AS metadata
+ 'event' AS type,
+ ev AS value,
+ toTimeZone(customEV.created, '${safeTimezone}') AS created,
+ pid,
+ psid,
+ groupArrayIf(tuple(meta.key, meta.value), notEmpty(meta.key) AND notEmpty(meta.value)) AS metadata
FROM customEV
LEFT ARRAY JOIN meta.key, meta.value
WHERE
- pid = {pid:FixedString(12)}
- AND psid = {psid:String}
+ pid = {pid:FixedString(12)}
+ AND psid = {psid:String}
GROUP BY type, value, created, pid, psid
)
SELECT
- type,
- value,
- created,
- metadata
+ type,
+ value,
+ created,
+ metadata
FROM events_with_meta
ORDER BY created ASC
`
const querySessionDetails = `
SELECT
- dv, br, os, lc, ref, so, me, ca, cc, rg, ct, sdur
+ dv, br, brv, os, osv, lc, ref, so, me, ca, cc, rg, ct, sdur
FROM analytics
WHERE
pid = {pid:FixedString(12)}
@@ -3629,7 +3629,7 @@ export class AnalyticsService {
if (!details) {
const querySessionDetailsBackup = `
SELECT
- dv, br, os, lc, ref, so, me, ca, cc, rg, ct, sdur
+ dv, br, brv, os, osv, lc, ref, so, me, ca, cc, rg, ct, sdur
FROM analytics
WHERE
pid = {pid:FixedString(12)}
diff --git a/backend/apps/selfhosted/src/analytics/analytics.service.ts b/backend/apps/selfhosted/src/analytics/analytics.service.ts
index 30f2241e7..0c9ec66e0 100644
--- a/backend/apps/selfhosted/src/analytics/analytics.service.ts
+++ b/backend/apps/selfhosted/src/analytics/analytics.service.ts
@@ -2933,48 +2933,48 @@ export class AnalyticsService {
const queryPages = `
WITH events_with_meta AS (
SELECT
- 'pageview' AS type,
- pg AS value,
- toTimeZone(analytics.created, '${safeTimezone}') AS created,
- pid,
- psid,
- groupArrayIf(tuple(meta.key, meta.value), notEmpty(meta.key) AND notEmpty(meta.value)) AS metadata
+ 'pageview' AS type,
+ pg AS value,
+ toTimeZone(analytics.created, '${safeTimezone}') AS created,
+ pid,
+ psid,
+ groupArrayIf(tuple(meta.key, meta.value), notEmpty(meta.key) AND notEmpty(meta.value)) AS metadata
FROM analytics
LEFT ARRAY JOIN meta.key, meta.value
WHERE
- pid = {pid:FixedString(12)}
- AND psid = {psid:String}
+ pid = {pid:FixedString(12)}
+ AND psid = {psid:String}
GROUP BY type, value, created, pid, psid
UNION ALL
SELECT
- 'event' AS type,
- ev AS value,
- toTimeZone(customEV.created, '${safeTimezone}') AS created,
- pid,
- psid,
- groupArrayIf(tuple(meta.key, meta.value), notEmpty(meta.key) AND notEmpty(meta.value)) AS metadata
+ 'event' AS type,
+ ev AS value,
+ toTimeZone(customEV.created, '${safeTimezone}') AS created,
+ pid,
+ psid,
+ groupArrayIf(tuple(meta.key, meta.value), notEmpty(meta.key) AND notEmpty(meta.value)) AS metadata
FROM customEV
LEFT ARRAY JOIN meta.key, meta.value
WHERE
- pid = {pid:FixedString(12)}
- AND psid = {psid:String}
+ pid = {pid:FixedString(12)}
+ AND psid = {psid:String}
GROUP BY type, value, created, pid, psid
)
SELECT
- type,
- value,
- created,
- metadata
+ type,
+ value,
+ created,
+ metadata
FROM events_with_meta
ORDER BY created ASC
`
const querySessionDetails = `
SELECT
- dv, br, os, lc, ref, so, me, ca, cc, rg, ct, sdur
+ dv, br, brv, os, osv, lc, ref, so, me, ca, cc, rg, ct, sdur
FROM analytics
WHERE
pid = {pid:FixedString(12)}
@@ -3010,7 +3010,7 @@ export class AnalyticsService {
if (!details) {
const querySessionDetailsBackup = `
SELECT
- dv, br, os, lc, ref, so, me, ca, cc, rg, ct, sdur
+ dv, br, brv, os, osv, lc, ref, so, me, ca, cc, rg, ct, sdur
FROM analytics
WHERE
pid = {pid:FixedString(12)}
diff --git a/web/app/pages/Project/View/components/SessionDetails.tsx b/web/app/pages/Project/View/components/SessionDetails.tsx
index 6eb1d8511..7e80e2894 100644
--- a/web/app/pages/Project/View/components/SessionDetails.tsx
+++ b/web/app/pages/Project/View/components/SessionDetails.tsx
@@ -33,6 +33,28 @@ export const SessionDetails = ({ details }: ISessionDetailsComponent) => {
},
]
+ const browser = [
+ {
+ label: t('project.mapping.br'),
+ value: details.br || 'N/A',
+ },
+ {
+ label: t('project.mapping.brv'),
+ value: details.brv || 'N/A',
+ },
+ ]
+
+ const os = [
+ {
+ label: t('project.mapping.os'),
+ value: details.os || 'N/A',
+ },
+ {
+ label: t('project.mapping.osv'),
+ value: details.osv || 'N/A',
+ },
+ ]
+
const utm = [
{
label: t('project.mapping.so'),
@@ -80,12 +102,12 @@ export const SessionDetails = ({ details }: ISessionDetailsComponent) => {
)
}}
/>
- <MetricCard
+ <MetricCardSelect
classes={{
value: 'max-md:text-xl md:text-3xl',
}}
- label={t('project.mapping.os')}
- value={details.os || 'N/A'}
+ values={os}
+ selectLabel={t('project.osInfo')}
/>
<MetricCard
classes={{
@@ -95,12 +117,12 @@ export const SessionDetails = ({ details }: ISessionDetailsComponent) => {
value={details.dv || 'N/A'}
valueMapper={(value) => _capitalize(value)}
/>
- <MetricCard
+ <MetricCardSelect
classes={{
value: 'max-md:text-xl md:text-3xl',
}}
- label={t('project.mapping.br')}
- value={details.br || 'N/A'}
+ values={browser}
+ selectLabel={t('project.browserInfo')}
/>
<MetricCard
classes={{
diff --git a/web/app/pages/Project/View/interfaces/session.tsx b/web/app/pages/Project/View/interfaces/session.tsx
index 8277bb933..5bf892db3 100644
--- a/web/app/pages/Project/View/interfaces/session.tsx
+++ b/web/app/pages/Project/View/interfaces/session.tsx
@@ -11,7 +11,9 @@ export interface ISession {
export interface ISessionDetails {
cc: string | null
os: string | null
+ osv: string | null
br: string | null
+ brv: string | null
lc: string | null
ref: string | null
so: string | null