Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

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.ts
index 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 links
if (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)