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.

Add invoice ID to table

Tim Wilson1ca5ff904198
diff --git a/apps/web/lib/zod/schemas/sales.ts b/apps/web/lib/zod/schemas/sales.ts
index 400be53e53..07e36bd31f 100644
--- a/apps/web/lib/zod/schemas/sales.ts
+++ b/apps/web/lib/zod/schemas/sales.ts
@@ -80,6 +80,7 @@ export const saleEventEnrichedSchema = z.object({
customer_email: z.string(),
customer_avatar: z.string(),
payment_processor: z.string(),
+ invoice_id: z.string(),
amount: z.number(),
click_id: z.string(),
link_id: z.string(),
diff --git a/apps/web/ui/analytics/events/events-table.tsx b/apps/web/ui/analytics/events/events-table.tsx
index d55ec77c84..719187d2cc 100644
--- a/apps/web/ui/analytics/events/events-table.tsx
+++ b/apps/web/ui/analytics/events/events-table.tsx
@@ -68,8 +68,16 @@ const eventColumns: Record<
],
},
sales: {
- all: ["event", "link", "country", "device", "amount", "timestamp"],
- defaultVisible: ["saleType", "link", "country", "amount", "timestamp"],
+ all: [
+ "event",
+ "invoiceId",
+ "link",
+ "country",
+ "device",
+ "amount",
+ "timestamp",
+ ],
+ defaultVisible: ["event", "link", "country", "amount", "timestamp"],
},
};
@@ -111,6 +119,16 @@ export default function EventsTable() {
id: "event",
header: "Event",
accessorKey: "event_name",
+ cell: ({ getValue }) =>
+ getValue() || <span className="text-gray-400">-</span>,
+ },
+ // Sale invoice ID
+ {
+ id: "invoiceId",
+ header: "Invoice ID",
+ accessorKey: "invoice_id",
+ cell: ({ getValue }) =>
+ getValue() || <span className="text-gray-400">-</span>,
},
{
id: "link",
diff --git a/packages/tinybird/datasources/dub_sale_events_mv.datasource b/packages/tinybird/datasources/dub_sale_events_mv.datasource
index 999450e94a..f9b708c54f 100644
--- a/packages/tinybird/datasources/dub_sale_events_mv.datasource
+++ b/packages/tinybird/datasources/dub_sale_events_mv.datasource
@@ -6,6 +6,7 @@ SCHEMA >
`link_id` String,
`customer_id` String,
`payment_processor` LowCardinality(String),
+ `invoice_id` String,
`amount` UInt32,
`url` String,
`country` LowCardinality(String),
diff --git a/packages/tinybird/pipes/dub_sale_events_pipe.pipe b/packages/tinybird/pipes/dub_sale_events_pipe.pipe
index 841343fb38..f79e69ce18 100644
--- a/packages/tinybird/pipes/dub_sale_events_pipe.pipe
+++ b/packages/tinybird/pipes/dub_sale_events_pipe.pipe
@@ -9,6 +9,7 @@ SQL >
link_id,
customer_id,
payment_processor,
+ invoice_id,
amount,
url,
country,
diff --git a/packages/tinybird/pipes/v1_events.pipe b/packages/tinybird/pipes/v1_events.pipe
index 5e2918a191..0667f45285 100644
--- a/packages/tinybird/pipes/v1_events.pipe
+++ b/packages/tinybird/pipes/v1_events.pipe
@@ -1,5 +1,5 @@
DESCRIPTION >
- Top countries
+ Clicks, leads, and sales events
TOKEN "v1_events_endpoint_read_2795" READ
@@ -113,6 +113,7 @@ SQL >
dse.event_name as event_name,
dse.amount as amount,
dse.payment_processor as payment_processor,
+ dse.invoice_id as invoice_id,
dcm.name as customer_name,
dcm.email as customer_email,
dcm.avatar as customer_avatar,