The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
update leadEventName
Steven Tey1673578c5b19
diff --git a/apps/web/lib/api/conversions/track-sale.ts b/apps/web/lib/api/conversions/track-sale.tsindex 29163c650b..702e638d9c 100644--- a/apps/web/lib/api/conversions/track-sale.ts+++ b/apps/web/lib/api/conversions/track-sale.ts@@ -242,7 +242,8 @@ export const trackSale = async ({leadEventData = {...clickData,event_id: nanoid(16),- event_name: "Sign up",+ // if leadEventName is provided, use it, otherwise use "Sign up"+ event_name: leadEventName ?? "Sign up",customer_id: newCustomer.id,metadata: metadata ? JSON.stringify(metadata) : "",};diff --git a/apps/web/lib/zod/schemas/sales.ts b/apps/web/lib/zod/schemas/sales.tsindex 25cf856898..f6403e0fde 100644--- a/apps/web/lib/zod/schemas/sales.ts+++ b/apps/web/lib/zod/schemas/sales.ts@@ -47,14 +47,6 @@ export const trackSaleRequestSchema = z.object({.describe("The invoice ID of the sale. Can be used as a idempotency key – only one sale event can be recorded for a given invoice ID.",),- leadEventName: z- .string()- .nullish()- .default(null)- .describe(- "The name of the lead event that occurred before the sale (case-sensitive). This is used to associate the sale event with a particular lead event (instead of the latest lead event for a link-customer combination, which is the default behavior).",- )- .openapi({ example: "Cloned template 1481267" }),metadata: z.record(z.unknown()).nullish()@@ -65,7 +57,15 @@ export const trackSaleRequestSchema = z.object({.describe("Additional metadata to be stored with the sale event. Max 10,000 characters when stringified.",),- // for tracking lead + sale together+ // advanced fields: leadEventName + fields for sale tracking without a pre-existing lead event+ leadEventName: z+ .string()+ .nullish()+ .default(null)+ .describe(+ "The name of the lead event that occurred before the sale (case-sensitive). This is used to associate the sale event with a particular lead event (instead of the latest lead event for a link-customer combination, which is the default behavior). For sale tracking without a pre-existing lead event, this field can also be used to specify the lead event name.",+ )+ .openapi({ example: "Cloned template 1481267" }),clickId: z.string().trim()