📈 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
Use rgc parameter for region detection on map
Blue Mousece333ec81139
diff --git a/web/app/lib/models/Entry.ts b/web/app/lib/models/Entry.tsindex 1acbf8b05..85faea4b6 100644--- a/web/app/lib/models/Entry.ts+++ b/web/app/lib/models/Entry.ts@@ -2,8 +2,10 @@ export interface Entry {name: stringcount: numbercc?: string+ rgc?: string}export interface CountryEntry extends Entry {cc: string+ rgc?: string}diff --git a/web/app/pages/Project/View/components/InteractiveMap.tsx b/web/app/pages/Project/View/components/InteractiveMap.tsxindex 8b190e1f7..b0faebe34 100644--- a/web/app/pages/Project/View/components/InteractiveMap.tsx+++ b/web/app/pages/Project/View/components/InteractiveMap.tsx@@ -80,11 +80,17 @@ const InteractiveMapCore = ({ data, regionData, onClickCountry, total }: Interacif (!currentData) return lookupcurrentData.forEach((item) => {- const key = mapView === 'countries' ? item.cc || item.name : item.name- if (key) {- lookup.set(key.toLowerCase(), item)- // For regions, only add exact name matches to avoid conflicts- // Don't create word-based lookups that can cause multiple regions to match the same data+ if (mapView === 'countries') {+ const key = item.cc || item.name+ if (key) {+ lookup.set(key.toLowerCase(), item)+ }+ } else {+ // Regions: use ISO-based key "CC-RGC" (e.g., UA-05, GB-ENG)+ if (item.cc && item.rgc) {+ const isoKey = `${item.cc}-${item.rgc}`.toLowerCase()+ lookup.set(isoKey, item)+ }}})@@ -116,28 +122,11 @@ const InteractiveMapCore = ({ data, regionData, onClickCountry, total }: Interacconst found = dataLookup.get(props.iso_a2?.toLowerCase() || '')if (found) return { data: found, key: found.cc || found.name }} else {- const { name } = props- if (name) {- const found = dataLookup.get(name.toLowerCase() || '')- if (found) return { data: found, key: found.name }-- // For regions, also try some common name variations but avoid fuzzy matching- // TODO: Replace is with ISO code lookup later- const variations = [- name.toLowerCase().trim(),- name.toLowerCase().replace(/\s+/g, ''),- name- .toLowerCase()- .replace(/oblast|province|region|state/g, '')- .trim(),- ]-- for (const variation of variations) {- if (variation && variation.length > 1) {- const found = dataLookup.get(variation)- if (found) return { data: found, key: found.name }- }- }+ // Regions: match strictly by ISO code from GeoJSON+ const iso = (props as any)?.iso_3166_2 as string | undefined+ if (iso) {+ const found = dataLookup.get(iso.toLowerCase())+ if (found) return { data: found, key: found.cc || found.name }}}