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.
TypeScript analyticsaudience-segmentationchartscohort-analysisgoogle-analyticsproduct-analyticsstatisticsuser-journeyweb-analytics
add support for CloudFront headers in getLocation
Michael Wallner8df72c55e564
diff --git a/src/lib/detect.ts b/src/lib/detect.tsindex 2e6a067dd..526ea2dfc 100644--- a/src/lib/detect.ts+++ b/src/lib/detect.ts@@ -119,6 +119,19 @@ export async function getLocation(ip: string = '', headers: Headers, hasPayloadIcity,};}++ // CloudFront headers+ if (headers.get('cloudfront-viewer-country')) {+ const country = decodeHeader(headers.get('cloudfront-viewer-country'));+ const region = decodeHeader(headers.get('cloudfront-viewer-country-region'));+ const city = decodeHeader(headers.get('cloudfront-viewer-city'));++ return {+ country,+ region: getRegionCode(country, region),+ city,+ };+ }}// Database lookup