📈 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
fix: Opening sessions with custom events in them in the profile inspector may case page to crash
Blue Mouse8fb7cfc76629
diff --git a/backend/apps/cloud/src/analytics/analytics.service.ts b/backend/apps/cloud/src/analytics/analytics.service.tsindex 5a156d097..64d386e00 100644--- a/backend/apps/cloud/src/analytics/analytics.service.ts+++ b/backend/apps/cloud/src/analytics/analytics.service.ts@@ -6736,9 +6736,11 @@ export class AnalyticsService {})): undefined- // For sale and refund events, extract amount and currency from metadata+ // For monetary events, extract amount and currency from metadataif (- (page.type === 'sale' || page.type === 'refund') &&+ (page.type === 'sale' ||+ page.type === 'subscription' ||+ page.type === 'refund') &&processedMetadata) {const amountEntry = processedMetadata.find((m) => m.key === 'amount')diff --git a/backend/apps/cloud/src/analytics/interfaces/index.ts b/backend/apps/cloud/src/analytics/interfaces/index.tsindex 55938e04d..89dc8a18a 100644--- a/backend/apps/cloud/src/analytics/interfaces/index.ts+++ b/backend/apps/cloud/src/analytics/interfaces/index.ts@@ -209,7 +209,7 @@ export interface IOverallPerformance {}export interface IPageflow {- type: 'pageview' | 'event' | 'error' | 'sale' | 'refund'+ type: 'pageview' | 'event' | 'error' | 'sale' | 'subscription' | 'refund'value: stringcreated: stringpsid?: stringdiff --git a/web/app/api/api.server.ts b/web/app/api/api.server.tsindex c4ba053b8..32c0bab14 100644--- a/web/app/api/api.server.ts+++ b/web/app/api/api.server.ts@@ -1174,7 +1174,7 @@ export async function getGoalSessionsServer(}interface PageflowItem {- type: 'pageview' | 'event' | 'error' | 'sale' | 'refund'+ type: 'pageview' | 'event' | 'error' | 'sale' | 'subscription' | 'refund'value: stringcreated: stringmetadata?: { key: string; value: string }[]diff --git a/web/app/pages/Project/tabs/Profiles/ProfileDetails.tsx b/web/app/pages/Project/tabs/Profiles/ProfileDetails.tsxindex 857207603..5187780b7 100644--- a/web/app/pages/Project/tabs/Profiles/ProfileDetails.tsx+++ b/web/app/pages/Project/tabs/Profiles/ProfileDetails.tsx@@ -57,7 +57,7 @@ const RECENTLY_ACTIVE_THRESHOLD_MINUTES = 30type OnlineStatus = 'online' | 'recently_active' | 'offline'interface PageflowItem {- type: 'pageview' | 'event' | 'error' | 'sale' | 'refund'+ type: 'pageview' | 'event' | 'error' | 'sale' | 'subscription' | 'refund'value: stringcreated: stringmetadata?: { key: string; value: string }[]@@ -160,7 +160,8 @@ const getSessionDuration = (session: ProfileSession) => {}const interactionPages = (session.pages || []).filter(- ({ type }) => type !== 'sale' && type !== 'refund',+ ({ type }) =>+ type !== 'sale' && type !== 'subscription' && type !== 'refund',)if (interactionPages.length < 2) {return 0diff --git a/web/app/pages/Project/tabs/Sessions/Pageflow.tsx b/web/app/pages/Project/tabs/Sessions/Pageflow.tsxindex 7b8fd7bc4..1f7318bf0 100644--- a/web/app/pages/Project/tabs/Sessions/Pageflow.tsx+++ b/web/app/pages/Project/tabs/Sessions/Pageflow.tsx@@ -13,6 +13,7 @@ import {FileTextIcon,CursorClickIcon,ArrowCounterClockwiseIcon,+ ArrowsClockwiseIcon,TagIcon,ClockIcon,ClockCounterClockwiseIcon,@@ -37,6 +38,7 @@ export type PageflowEventType =| 'event'| 'error'| 'sale'+ | 'subscription'| 'refund'export interface PageflowEvent {@@ -80,6 +82,7 @@ export const PAGEFLOW_ICON_BY_TYPE: Record<event: CursorClickIcon,error: WarningIcon,sale: CurrencyDollarIcon,+ subscription: ArrowsClockwiseIcon,refund: ArrowCounterClockwiseIcon,}@@ -88,6 +91,7 @@ export const PAGEFLOW_ICON_COLOR_BY_TYPE: Record<PageflowEventType, string> = {event: 'text-green-500',error: 'text-red-500',sale: 'text-emerald-500',+ subscription: 'text-teal-500',refund: 'text-orange-500',}@@ -156,12 +160,12 @@ const TypeIcon = ({type: PageflowEventTypeclassName?: string}) => {- const Icon = PAGEFLOW_ICON_BY_TYPE[type]+ const Icon = PAGEFLOW_ICON_BY_TYPE[type] ?? CursorClickIconreturn (<IconclassName={cn('h-4 w-4 shrink-0',- PAGEFLOW_ICON_COLOR_BY_TYPE[type],+ PAGEFLOW_ICON_COLOR_BY_TYPE[type] ?? 'text-gray-400',className,)}weight='duotone'@@ -298,7 +302,8 @@ const PageflowItem = ({const [isExpanded, setIsExpanded] = useState(false)const hasMetadata = !!metadata && metadata.length > 0- const isMonetary = type === 'sale' || type === 'refund'+ const isMonetary =+ type === 'sale' || type === 'subscription' || type === 'refund'const hasDuration = timeDuration !== null && timeDuration > 0const showSubRow = hasDuration || hasMetadata@@ -318,7 +323,7 @@ const PageflowItem = ({<Textsize='sm'weight='semibold'- colour={type === 'sale' ? 'success' : 'warning'}+ colour={type === 'refund' ? 'warning' : 'success'}className='leading-4 tabular-nums'>{type === 'refund' ? '−' : '+'}diff --git a/web/app/pages/Project/tabs/Sessions/SessionReplayModal.tsx b/web/app/pages/Project/tabs/Sessions/SessionReplayModal.tsxindex 94405ee83..b70c26df4 100644--- a/web/app/pages/Project/tabs/Sessions/SessionReplayModal.tsx+++ b/web/app/pages/Project/tabs/Sessions/SessionReplayModal.tsx@@ -165,6 +165,7 @@ const PAGEFLOW_EVENT_LABEL_DEFAULTS: Record<PageflowEventType, string> = {event: 'Event',error: 'Error',sale: 'Sale',+ subscription: 'Subscription',refund: 'Refund',}@@ -497,7 +498,11 @@ const getPageflowEventLabel = (type: PageflowEventType, t: TFunction) =>)const getPageflowEventDetail = (event: PageflowEvent, t: TFunction) => {- if (event.type === 'sale' || event.type === 'refund') {+ if (+ event.type === 'sale' ||+ event.type === 'subscription' ||+ event.type === 'refund'+ ) {const sign = event.type === 'refund' ? '-' : '+'const amount = `${sign}${formatPageflowAmount(event.amount || 0,@@ -929,7 +934,7 @@ const PlayerIconButton = ({)const PageflowMarkerTooltip = ({ marker }: { marker: PageflowMarker }) => {- const Icon = PAGEFLOW_ICON_BY_TYPE[marker.type]+ const Icon = PAGEFLOW_ICON_BY_TYPE[marker.type] ?? CursorClickIconreturn (<div className='min-w-0'>@@ -937,7 +942,7 @@ const PageflowMarkerTooltip = ({ marker }: { marker: PageflowMarker }) => {<IconclassName={cn('size-4 shrink-0',- PAGEFLOW_ICON_COLOR_BY_TYPE[marker.type],+ PAGEFLOW_ICON_COLOR_BY_TYPE[marker.type] ?? 'text-gray-400',)}weight='duotone'aria-hiddendiff --git a/web/app/pages/Project/tabs/Sessions/SessionsView.tsx b/web/app/pages/Project/tabs/Sessions/SessionsView.tsxindex c3d9e8763..0aba7bec1 100644--- a/web/app/pages/Project/tabs/Sessions/SessionsView.tsx+++ b/web/app/pages/Project/tabs/Sessions/SessionsView.tsx@@ -34,7 +34,7 @@ import { LoaderView } from '../../View/components/LoaderView'const SESSIONS_TAKE = 30interface PageflowItem {- type: 'pageview' | 'event' | 'error' | 'sale' | 'refund'+ type: 'pageview' | 'event' | 'error' | 'sale' | 'subscription' | 'refund'value: stringcreated: stringmetadata?: { key: string; value: string }[]diff --git a/web/public/locales/de.json b/web/public/locales/de.jsonindex ecc60c8d8..72e77e604 100644--- a/web/public/locales/de.json+++ b/web/public/locales/de.json@@ -1942,6 +1942,7 @@"event": "Ereignis","error": "Fehler","sale": "Verkauf",+ "subscription": "Abonnement","refund": "Rückerstattung"},"timeline": {diff --git a/web/public/locales/en.json b/web/public/locales/en.jsonindex cb7eb9691..2829017ff 100644--- a/web/public/locales/en.json+++ b/web/public/locales/en.json@@ -1942,6 +1942,7 @@"event": "Event","error": "Error","sale": "Sale",+ "subscription": "Subscription","refund": "Refund"},"timeline": {diff --git a/web/public/locales/fr.json b/web/public/locales/fr.jsonindex 16178dd81..d00b147fa 100644--- a/web/public/locales/fr.json+++ b/web/public/locales/fr.json@@ -1942,6 +1942,7 @@"event": "Événement","error": "Erreur","sale": "Vente",+ "subscription": "Abonnement","refund": "Remboursement"},"timeline": {diff --git a/web/public/locales/pl.json b/web/public/locales/pl.jsonindex 92db9f4f6..1b789b874 100644--- a/web/public/locales/pl.json+++ b/web/public/locales/pl.json@@ -1942,6 +1942,7 @@"event": "Zdarzenie","error": "Błąd","sale": "Sprzedaż",+ "subscription": "Subskrypcja","refund": "Zwrot"},"timeline": {diff --git a/web/public/locales/pt.json b/web/public/locales/pt.jsonindex 26c8ba6ec..38bb2337c 100644--- a/web/public/locales/pt.json+++ b/web/public/locales/pt.json@@ -1942,6 +1942,7 @@"event": "Evento","error": "Erro","sale": "Venda",+ "subscription": "Assinatura","refund": "Reembolso"},"timeline": {diff --git a/web/public/locales/uk.json b/web/public/locales/uk.jsonindex 4bad47e6c..fc829eec5 100644--- a/web/public/locales/uk.json+++ b/web/public/locales/uk.json@@ -1942,6 +1942,7 @@"event": "Подія","error": "Помилка","sale": "Продаж",+ "subscription": "Підписка","refund": "Повернення"},"timeline": {