The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
adjust the count response
Kiran K8ebf51428166
diff --git a/apps/web/lib/analytics/get-analytics.ts b/apps/web/lib/analytics/get-analytics.tsindex 369243da99..bd2233314a 100644--- a/apps/web/lib/analytics/get-analytics.ts+++ b/apps/web/lib/analytics/get-analytics.ts@@ -79,7 +79,15 @@ export const getAnalytics = async (granularity,});- // for total clicks|leads|sales, we return just the value;+ // for total clicks|leads, we return just the value;// everything else we return an array of values- return endpoint === "count" ? response.data[0][analyticsType] : response.data;+ if (endpoint === "count") {+ if (["clicks", "leads"].includes(analyticsType)) {+ return response.data[0][analyticsType];+ } else {+ return response.data[0];+ }+ }++ return response.data;};