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
Merge branch 'dev' into jajaja
Mike Cao002750270779
diff --cc src/app/api/send/route.tsindex 60d6f7af0,65c88a285..62212b5f1--- a/src/app/api/send/route.ts+++ b/src/app/api/send/route.ts@@@ -145,7 -145,7 +145,8 @@@ export async function POST(request: Reqconst base = hostname ? `https://${hostname}` : 'https://localhost';const currentUrl = new URL(url, base);- let urlPath = currentUrl.pathname === '/undefined' ? '' : currentUrl.pathname;- let urlPath = currentUrl.pathname === '/undefined' ? '' : currentUrl.pathname + currentUrl.hash;++ let urlPath =++ currentUrl.pathname === '/undefined' ? '' : currentUrl.pathname + currentUrl.hash;const urlQuery = currentUrl.search.substring(1);const urlDomain = currentUrl.hostname.replace(/^www./, '');diff --cc src/lib/detect.tsindex 137b01674,99c101abd..4a5985eb7--- a/src/lib/detect.ts+++ b/src/lib/detect.ts@@@ -121,13 -121,13 +121,15 @@@ export async function getLocation(ip: s}// Database lookup- if (!global[MAXMIND]) {+ if (!globalThis[MAXMIND]) {const dir = path.join(process.cwd(), 'geo');- globalThis[MAXMIND] = await maxmind.open(path.resolve(dir, 'GeoLite2-City.mmdb'));- global[MAXMIND] = await maxmind.open(process.env.GEOLITE_DB_PATH || path.resolve(dir, 'GeoLite2-City.mmdb'));++ globalThis[MAXMIND] = await maxmind.open(++ process.env.GEOLITE_DB_PATH || path.resolve(dir, 'GeoLite2-City.mmdb'),++ );}- const result = global[MAXMIND].get(ip);+ const result = globalThis[MAXMIND].get(ip);if (result) {const country = result.country?.iso_code ?? result?.registered_country?.iso_code;diff --cc src/queries/sql/reports/getRevenue.tsindex a7062f47a,f7996fcc9..49d46a1f8--- a/src/queries/sql/reports/getRevenue.ts+++ b/src/queries/sql/reports/getRevenue.ts@@@ -163,19 -179,12 +163,12 @@@ async function clickhouseQuery`selectevent_name x,- ${getDateSQL('created_at', unit, timezone)} t,+ ${getDateSQL('created_at', unit)} t,- sum(coalesce(toDecimal64(number_value, 2), toDecimal64(string_value, 2))) y- from event_data- join (select event_id- from event_data- where website_id = {websiteId:UUID}- and created_at between {startDate:DateTime64} and {endDate:DateTime64}- and positionCaseInsensitive(data_key, 'currency') > 0- and string_value = {currency:String}) currency- on currency.event_id = event_data.event_id+ sum(revenue) y+ from website_revenuewhere website_id = {websiteId:UUID}and created_at between {startDate:DateTime64} and {endDate:DateTime64}- and positionCaseInsensitive(data_key, 'revenue') > 0+ and currency = {currency:String}group by x, torder by t`,@@@ -250,24 -245,17 +229,17 @@@>(`select- c.currency,- sum(coalesce(toDecimal64(ed.number_value, 2), toDecimal64(ed.string_value, 2))) as sum,- uniqExact(ed.event_id) as count,- uniqExact(ed.session_id) as unique_count- from event_data ed- join (select event_id, string_value as currency- from event_data- where website_id = {websiteId:UUID}- and created_at between {startDate:DateTime64} and {endDate:DateTime64}- and positionCaseInsensitive(data_key, 'currency') > 0) c- on c.event_id = ed.event_id+ currency,+ sum(revenue) as sum,+ uniqExact(event_id) as count,+ uniqExact(session_id) as unique_count+ from website_revenuewhere website_id = {websiteId:UUID}and created_at between {startDate:DateTime64} and {endDate:DateTime64}- and positionCaseInsensitive(data_key, 'revenue') > 0- group by c.currency- order by sum desc;+ group by currency+ order by sum desc`,- { websiteId, startDate, endDate, unit, timezone, currency },+ { websiteId, startDate, endDate, unit, currency },);return { chart: chartRes, country: countryRes, total: totalRes, table: tableRes };