diff --git a/src/components/metrics/WorldMap.tsx b/src/components/metrics/WorldMap.tsx index 4a16f98f77..5dfc5f742f 100644 --- a/src/components/metrics/WorldMap.tsx +++ b/src/components/metrics/WorldMap.tsx @@ -28,6 +28,7 @@ export function WorldMap({ const { formatMessage, labels } = useMessages(); const { countryNames } = useCountryNames(locale); const visitorsLabel = formatMessage(labels.visitors).toLocaleLowerCase(locale); + const unknownLabel = formatMessage(labels.unknown); const { dateRange: { startDate, endDate }, } = useDateRange(websiteId); @@ -62,7 +63,9 @@ export function WorldMap({ if (code === 'AQ') return; const country = metrics?.find(({ x }) => x === code); setTooltipPopup( - `${countryNames[code]}: ${formatLongNumber(country?.y || 0)} ${visitorsLabel}` as any, + `${countryNames[code] || unknownLabel}: ${formatLongNumber( + country?.y || 0, + )} ${visitorsLabel}` as any, ); }; diff --git a/src/tracker/index.js b/src/tracker/index.js index 6b5b706620..e0c036894d 100644 --- a/src/tracker/index.js +++ b/src/tracker/index.js @@ -6,7 +6,7 @@ document, history, } = window; - const { hostname, href } = location; + const { hostname, href, origin } = location; const { currentScript, referrer } = document; const localStorage = href.startsWith('data:') ? undefined : window.localStorage; @@ -260,7 +260,7 @@ } let currentUrl = parseURL(href); - let currentRef = referrer !== hostname ? referrer : ''; + let currentRef = referrer.startsWith(origin) ? '' : referrer; let title = document.title; let cache; let initialized;