The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
add sale event properties to the datasource
Kiran K047f9943a60c
diff --git a/apps/web/app/api/track/route.ts b/apps/web/app/api/track/route.tsindex a27632dd6b..8f2ab27c47 100644--- a/apps/web/app/api/track/route.ts+++ b/apps/web/app/api/track/route.ts@@ -37,6 +37,17 @@ export const POST = withSessionEdge(async ({ req }) => {}): recordSale({...conversionEvent,++ // TODO: Fix this+ payment_processor: "stripe",+ stripe_customer_id: "",+ product_id: "",+ amount: 1000,+ currency: "usd",+ recurring: true,+ recurring_interval: "month",+ recurring_interval_count: 1,+ refunded: false,}),// TODO: Remove this before launchdiff --git a/apps/web/lib/zod/schemas/conversions.ts b/apps/web/lib/zod/schemas/conversions.tsindex 281963faf4..863c60bbe3 100644--- a/apps/web/lib/zod/schemas/conversions.ts+++ b/apps/web/lib/zod/schemas/conversions.ts@@ -48,6 +48,15 @@ export const saleEventSchemaTB = clickEventSchemaTB.omit({ url: true }).and(event_id: z.string(),metadata: z.string(), // TODO: Fix the typecustomer_id: z.string(),+ payment_processor: z.string().default("stripe"),+ stripe_customer_id: z.string(),+ product_id: z.string(),+ amount: z.number().int().positive().default(0),+ currency: z.string().default("usd"),+ recurring: z.boolean().default(false),+ recurring_interval: z.enum(["month", "year"]).default("month"),+ recurring_interval_count: z.number().int().positive().default(1),+ refunded: z.boolean().default(false),}),);diff --git a/packages/tinybird/datasources/dub_sale_events.datasource b/packages/tinybird/datasources/dub_sale_events.datasourceindex bb57b6f3b3..109d838d9d 100644--- a/packages/tinybird/datasources/dub_sale_events.datasource+++ b/packages/tinybird/datasources/dub_sale_events.datasource@@ -3,7 +3,16 @@ SCHEMA >`timestamp` DateTime64(3) `json:$.timestamp`,`event_id` String `json:$.event_id`,`metadata` String `json:$.metadata`,- `customer_id` String `json:$.customer_id`,+ `customer_id` String `json:$.customer_id`,+ `payment_processor` LowCardinality(String) `json:$.payment_processor`,+ `stripe_customer_id` String `json:$.stripe_customer_id`,+ `product_id` String `json:$.product_id`,+ `amount` UInt32 `json:$.amount`,+ `currency` LowCardinality(String) `json:$.currency`,+ `recurring` UInt8 `json:$.recurring`,+ `recurring_interval` LowCardinality(String) `json:$.recurring_interval`,+ `recurring_interval_count` UInt8 `json:$.recurring_interval_count`,+ `refunded` UInt8 `json:$.refunded`,`click_id` String `json:$.click_id`,`link_id` String `json:$.link_id`,`country` LowCardinality(String) `json:$.country`,