The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Add click not record logs
Steven Teyd73615f78757
diff --git a/apps/web/lib/analytics/verify-analytics-allowed-hostnames.ts b/apps/web/lib/analytics/verify-analytics-allowed-hostnames.tsindex a06e3b131c..b1fc655863 100644--- a/apps/web/lib/analytics/verify-analytics-allowed-hostnames.ts+++ b/apps/web/lib/analytics/verify-analytics-allowed-hostnames.ts@@ -15,7 +15,7 @@ export const verifyAnalyticsAllowedHostnames = ({const hostname = sourceUrl?.hostname.replace(/^www\./, "");if (!hostname) {- console.log("No hostname found in request. Denying request ❌", {+ console.log("Click not recorded ❌ – No hostname found in request.", {allowedHostnames,});return false;@@ -39,7 +39,7 @@ export const verifyAnalyticsAllowedHostnames = ({}console.log(- `Hostname ${hostname} does not match any allowed patterns. Denying request ❌`,+ `Click not recorded ❌ – Hostname ${hostname} does not match any allowed patterns.`,{allowedHostnames,},diff --git a/apps/web/lib/tinybird/record-click.ts b/apps/web/lib/tinybird/record-click.tsindex bc9f08a641..2e124f262d 100644--- a/apps/web/lib/tinybird/record-click.ts+++ b/apps/web/lib/tinybird/record-click.ts@@ -69,10 +69,15 @@ export async function recordClick({return null;}+ const ua = userAgent(req);const isBot = detectBot(req);// don't record clicks from botsif (isBot) {+ console.log(`Click not recorded ❌ – Bot detected.`, {+ ua,+ isBot,+ });return null;}@@ -106,7 +111,6 @@ export async function recordClick({const isEuCountry = geo.country && EU_COUNTRY_CODES.includes(geo.country);- const ua = userAgent(req);const referer = referrer || req.headers.get("referer");const identity_hash = await getIdentityHash(req);