mirror of
https://github.com/umami-software/umami.git
synced 2026-02-06 13:47:15 +01:00
fix some components in realtime data
This commit is contained in:
parent
6dd90ce9ca
commit
05ece6a4d0
6 changed files with 21 additions and 67 deletions
|
|
@ -57,7 +57,7 @@ export default function RealtimeLog({ data, websiteDomain }) {
|
|||
const getIcon = ({ __type }) => icons[__type];
|
||||
|
||||
const getDetail = log => {
|
||||
const { __type, eventName, url, browser, os, country, device } = log;
|
||||
const { __type, eventName, urlPath: url, browser, os, country, device } = log;
|
||||
|
||||
if (__type === TYPE_EVENT) {
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -35,18 +35,14 @@ export default function RealtimeUrls({ websiteDomain, data = {} }) {
|
|||
if (pageviews) {
|
||||
const referrers = percentFilter(
|
||||
pageviews
|
||||
.reduce((arr, { referrer }) => {
|
||||
if (referrer?.startsWith('http')) {
|
||||
const hostname = new URL(referrer).hostname.replace(/^www\./, '');
|
||||
.reduce((arr, { referrerDomain }) => {
|
||||
if (referrerDomain) {
|
||||
const row = arr.find(({ x }) => x === referrerDomain);
|
||||
|
||||
if (hostname) {
|
||||
const row = arr.find(({ x }) => x === hostname);
|
||||
|
||||
if (!row) {
|
||||
arr.push({ x: hostname, y: 1 });
|
||||
} else {
|
||||
row.y += 1;
|
||||
}
|
||||
if (!row) {
|
||||
arr.push({ x: referrerDomain, y: 1 });
|
||||
} else {
|
||||
row.y += 1;
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
|
|
@ -56,12 +52,12 @@ export default function RealtimeUrls({ websiteDomain, data = {} }) {
|
|||
|
||||
const pages = percentFilter(
|
||||
pageviews
|
||||
.reduce((arr, { url }) => {
|
||||
if (url?.startsWith('/')) {
|
||||
const row = arr.find(({ x }) => x === url);
|
||||
.reduce((arr, { urlPath }) => {
|
||||
if (urlPath?.startsWith('/')) {
|
||||
const row = arr.find(({ x }) => x === urlPath);
|
||||
|
||||
if (!row) {
|
||||
arr.push({ x: url, y: 1 });
|
||||
arr.push({ x: urlPath, y: 1 });
|
||||
} else {
|
||||
row.y += 1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue