diff --git a/components/metrics/RealtimeHeader.js b/components/metrics/RealtimeHeader.js index 40881538..1b93cd2f 100644 --- a/components/metrics/RealtimeHeader.js +++ b/components/metrics/RealtimeHeader.js @@ -9,11 +9,14 @@ import styles from './RealtimeHeader.module.css'; export default function RealtimeHeader({ websites, data, websiteId, onSelect }) { const options = [ - { label: , value: 0 }, + { + label: , + value: null, + }, ].concat( - websites.map(({ name, id }, index) => ({ + websites.map(({ name, websiteUuid }, index) => ({ label: name, - value: id, + value: websiteUuid, divider: index === 0, })), ); diff --git a/components/pages/RealtimeDashboard.js b/components/pages/RealtimeDashboard.js index 506d3722..628df62b 100644 --- a/components/pages/RealtimeDashboard.js +++ b/components/pages/RealtimeDashboard.js @@ -32,7 +32,7 @@ export default function RealtimeDashboard() { const { locale } = useLocale(); const countryNames = useCountryNames(locale); const [data, setData] = useState(); - const [websiteId, setWebsiteId] = useState(0); + const [websiteUuid, setWebsiteUuid] = useState(null); const { data: init, loading } = useFetch('/realtime/init'); const { data: updates } = useFetch('/realtime/update', { params: { start_at: data?.timestamp }, @@ -50,17 +50,18 @@ export default function RealtimeDashboard() { if (data) { const { pageviews, sessions, events } = data; - if (websiteId) { + if (websiteUuid) { + const { id } = init.websites.find(n => n.websiteUuid === websiteUuid); return { - pageviews: filterWebsite(pageviews, websiteId), - sessions: filterWebsite(sessions, websiteId), - events: filterWebsite(events, websiteId), + pageviews: filterWebsite(pageviews, id), + sessions: filterWebsite(sessions, id), + events: filterWebsite(events, id), }; } } return data; - }, [data, websiteId]); + }, [data, websiteUuid]); const countries = useMemo(() => { if (realtimeData?.sessions) { @@ -117,25 +118,20 @@ export default function RealtimeDashboard() {
- +
- + - + diff --git a/package.json b/package.json index facf913a..e586774f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "umami", - "version": "1.39.1", + "version": "1.39.2", "description": "A simple, fast, privacy-focused alternative to Google Analytics.", "author": "Mike Cao ", "license": "MIT", diff --git a/queries/analytics/stats/getRealtimeData.js b/queries/analytics/stats/getRealtimeData.js index 9e7eb673..659f6145 100644 --- a/queries/analytics/stats/getRealtimeData.js +++ b/queries/analytics/stats/getRealtimeData.js @@ -10,19 +10,19 @@ export async function getRealtimeData(websites, time) { ]); return { - pageviews: pageviews.map(({ pageviewId, ...props }) => ({ - __id: `p${pageviewId}`, - pageviewId, + pageviews: pageviews.map(({ id, ...props }) => ({ + __id: `p${id}`, + pageviewId: id, ...props, })), - sessions: sessions.map(({ sessionId, ...props }) => ({ - __id: `s${sessionId}`, - sessionId, + sessions: sessions.map(({ id, ...props }) => ({ + __id: `s${id}`, + sessionId: id, ...props, })), - events: events.map(({ eventId, ...props }) => ({ - __id: `e${eventId}`, - eventId, + events: events.map(({ id, ...props }) => ({ + __id: `e${id}`, + eventId: id, ...props, })), timestamp: Date.now(),