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
Prevent blank urls.
Mike Caoa026fc97fcd2
diff --git a/pages/api/send.ts b/pages/api/send.tsindex f6c8a3211..11e8f4c10 100644--- a/pages/api/send.ts+++ b/pages/api/send.ts@@ -96,6 +96,10 @@ export default async (req: NextApiRequestCollect, res: NextApiResponse) => {let [referrerPath, referrerQuery] = referrer?.split('?') || [];let referrerDomain;+ if (!urlPath) {+ urlPath = '/';+ }+if (referrerPath.startsWith('http')) {const refUrl = new URL(referrer);referrerPath = refUrl.pathname;@@ -104,7 +108,7 @@ export default async (req: NextApiRequestCollect, res: NextApiResponse) => {}if (process.env.REMOVE_TRAILING_SLASH) {- urlPath = urlPath.replace(/\/$/, '');+ urlPath = urlPath.replace(/.+\/$/, '');}await saveEvent({