The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Update get-final-url.ts
Kiran K60dafcaff197
diff --git a/apps/web/lib/middleware/utils/get-final-url.ts b/apps/web/lib/middleware/utils/get-final-url.tsindex af87e822ea..769a75a08d 100644--- a/apps/web/lib/middleware/utils/get-final-url.ts+++ b/apps/web/lib/middleware/utils/get-final-url.ts@@ -67,7 +67,18 @@ export const getFinalUrl = (// for Google Play Store linksif (isGooglePlayStoreUrl(url)) {const { shortLink } = parse(req);- urlObj.searchParams.set("referrer", shortLink);+ const existingReferrer = urlObj.searchParams.get("referrer");++ const referrerParams = new URLSearchParams(+ existingReferrer ? decodeURIComponent(existingReferrer) : "",+ );++ referrerParams.set("deepLink", shortLink);++ urlObj.searchParams.set(+ "referrer",+ encodeURIComponent(referrerParams.toString()),+ );}// if there are no query params, then return the target url as is (no need to parse it)