The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
domain and url only
Steven Tey244f8221e6dd
diff --git a/apps/web/app/api/track/visit/route.ts b/apps/web/app/api/track/visit/route.tsindex 1a03447c6b..95d2394df6 100644--- a/apps/web/app/api/track/visit/route.ts+++ b/apps/web/app/api/track/visit/route.ts@@ -30,21 +30,26 @@ const CORS_HEADERS = {export const POST = withAxiom(async (req: AxiomRequest) => {try {- const { domain, key, url } = await parseRequestBody(req);+ const { domain, url } = await parseRequestBody(req);- if (!domain || !key) {+ if (!domain || url) {throw new DubApiError({code: "bad_request",- message: "Missing domain or key",+ message: "Missing domain or url",});}const urlObj = new URL(url);+ let linkKey = urlObj.pathname.slice(1);+ if (linkKey === "") {+ linkKey = "_root";+ }+const ip = process.env.VERCEL === "1" ? ipAddress(req) : LOCALHOST_IP;const { success } = await ratelimit().limit(- `track-click:${domain}-${key}:${ip}`,+ `track-click:${domain}-${linkKey}:${ip}`,);if (!success) {@@ -54,11 +59,6 @@ export const POST = withAxiom(});}- let linkKey = urlObj.pathname.slice(1);- if (linkKey === "") {- linkKey = "_root";- }-const { rows } = await conn.execute<{id: string;url: string;