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.

Merge branch 'main' into click-cache-class

Kiran K0c0f9324a54b
diff --cc apps/web/lib/tinybird/record-click.ts
index e339f2be70,10bf0ac9ff..7c032e2d3d
--- a/apps/web/lib/tinybird/record-click.ts
+++ b/apps/web/lib/tinybird/record-click.ts
@@@ -149,8 -153,17 +151,15 @@@ export async function recordClick(
).then((res) => res.json()),
// cache the click ID in Redis for 1 hour
- redis.set(cacheKey, clickId, {
- ex: 60 * 60,
- }),
+ clickCache.set({ domain, key, ip, clickId }),
+ // cache the click data for 5 mins
+ // we're doing this because ingested click events are not available immediately in Tinybird
+ trackConversion &&
+ redis.set(`click:${clickId}`, clickData, {
+ ex: 60 * 5,
+ }),
+
// increment the click count for the link (based on their ID)
// we have to use planetscale connection directly (not prismaEdge) because of connection pooling
conn.execute(