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.

fix the click filter

Kiran Ked7afac9aee7
diff --git a/apps/web/ui/analytics/toggle.tsx b/apps/web/ui/analytics/toggle.tsx
index a69181ee5e..bf4955245a 100644
--- a/apps/web/ui/analytics/toggle.tsx
+++ b/apps/web/ui/analytics/toggle.tsx
@@ -497,30 +497,28 @@ export default function Toggle({
]),
],
},
- ...(["leads", "sales"].includes(selectedTab)
- ? [
- {
- key: "customerId",
- icon: User,
- label: "Customer",
- shouldFilter: !customersAsync,
- options:
- customers?.map(({ id, email, name, avatar }) => {
- return {
- value: id,
- label: email ?? name,
- icon: (
- <img
- src={avatar || `${OG_AVATAR_URL}${id}`}
- alt={`${email} avatar`}
- className="size-4 rounded-full"
- />
- ),
- };
- }) ?? null,
- },
- ]
- : []),
+
+ {
+ key: "customerId",
+ icon: User,
+ label: "Customer",
+ shouldFilter: !customersAsync,
+ options:
+ customers?.map(({ id, email, name, avatar }) => {
+ return {
+ value: id,
+ label: email ?? name,
+ icon: (
+ <img
+ src={avatar || `${OG_AVATAR_URL}${id}`}
+ alt={`${email} avatar`}
+ className="size-4 rounded-full"
+ />
+ ),
+ };
+ }) ?? null,
+ },
+
LinkFilterItem,
{
key: "root",
diff --git a/packages/tinybird/pipes/v2_events.pipe b/packages/tinybird/pipes/v2_events.pipe
index f5cbd568e5..c6e5b9b5db 100644
--- a/packages/tinybird/pipes/v2_events.pipe
+++ b/packages/tinybird/pipes/v2_events.pipe
@@ -49,6 +49,13 @@ SQL >
{% elif defined(workspaceId) or defined(partnerId) or defined(programId) %}
AND link_id IN (SELECT link_id FROM workspace_links)
{% end %}
+ {% if defined(customerId) %}
+ AND click_id IN (
+ SELECT DISTINCT click_id
+ FROM lead_events
+ WHERE customer_id = {{ String(customerId) }}
+ )
+ {% end %}
{% if defined(qr) %} AND qr = {{ Boolean(qr) }} {% end %}
{% if defined(continent) %} AND continent = {{ continent }} {% end %}
{% if defined(country) %} AND country = {{ country }} {% end %}