Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

Adding registered_country fallback to getCountry

effakt6b3eb7617ddb
diff --git a/lib/request.js b/lib/request.js
index 210921b98..78e0e351b 100644
--- a/lib/request.js
+++ b/lib/request.js
@@ -73,7 +73,8 @@ export async function getCountry(req, ip) {
const result = lookup.get(ip);
- return result?.country?.iso_code;
+ // country can not be set, fallback to registerd_country in this case
+ return result?.country?.iso_code ?? result?.registered_country?.iso_code;
}
export async function getClientInfo(req, { screen }) {