The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Update record-click.ts
Kiran K73a3881e93f9
diff --git a/apps/web/lib/tinybird/record-click.ts b/apps/web/lib/tinybird/record-click.tsindex e24c4008f4..a4e5a6bca6 100644--- a/apps/web/lib/tinybird/record-click.ts+++ b/apps/web/lib/tinybird/record-click.ts@@ -56,14 +56,14 @@ export async function recordClick({const cacheKey = `recordClick:${linkId}:${ip}`;- // if (!skipRatelimit) {- // // by default, we deduplicate clicks from the same IP address + link ID – only record 1 click per hour- // // here, we check if the clickId is cached in Redis within the last hour- // const cachedClickId = await redis.get<string>(cacheKey);- // if (cachedClickId) {- // return null;- // }- // }+ if (!skipRatelimit) {+ // by default, we deduplicate clicks from the same IP address + link ID – only record 1 click per hour+ // here, we check if the clickId is cached in Redis within the last hour+ const cachedClickId = await redis.get<string>(cacheKey);+ if (cachedClickId) {+ return null;+ }+ }const isQr = detectQr(req);