The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
get workspaceId from searchParams
Steven Tey4b8aa1458b7f
diff --git a/apps/web/app/api/track/customer/route.ts b/apps/web/app/api/track/customer/route.tsindex 8adc003b1e..6928d2ce23 100644--- a/apps/web/app/api/track/customer/route.ts+++ b/apps/web/app/api/track/customer/route.ts@@ -8,14 +8,11 @@ import { NextResponse } from "next/server";export const runtime = "edge";// POST /api/track/customer – Track a customer object-export const POST = withSessionEdge(async ({ req }) => {- const {- customerId,- customerName,- customerEmail,- customerAvatar,- workspaceId,- } = trackCustomerRequestSchema.parse(await parseRequestBody(req));+export const POST = withSessionEdge(async ({ req, searchParams }) => {+ const { workspaceId } = searchParams;++ const { customerId, customerName, customerEmail, customerAvatar } =+ trackCustomerRequestSchema.parse(await parseRequestBody(req));waitUntil(recordCustomer({diff --git a/apps/web/app/api/track/lead/route.ts b/apps/web/app/api/track/lead/route.tsindex d444e9262b..39f38bef1c 100644--- a/apps/web/app/api/track/lead/route.ts+++ b/apps/web/app/api/track/lead/route.ts@@ -9,7 +9,9 @@ import { NextResponse } from "next/server";export const runtime = "edge";// POST /api/track/lead – Track a lead conversion event-export const POST = withSessionEdge(async ({ req }) => {+export const POST = withSessionEdge(async ({ req, searchParams }) => {+ const { workspaceId } = searchParams;+const {clickId,eventName,@@ -18,7 +20,6 @@ export const POST = withSessionEdge(async ({ req }) => {customerName,customerEmail,customerAvatar,- workspaceId,} = trackLeadRequestSchema.parse(await parseRequestBody(req));waitUntil(diff --git a/apps/web/lib/zod/schemas/customers.ts b/apps/web/lib/zod/schemas/customers.tsindex 9e8fb6a989..058b5486b1 100644--- a/apps/web/lib/zod/schemas/customers.ts+++ b/apps/web/lib/zod/schemas/customers.ts@@ -1,7 +1,6 @@import z from "@/lib/zod";export const trackCustomerRequestSchema = z.object({- workspaceId: z.string({ required_error: "workspaceId is required" }),customerId: z.string({ required_error: "customerId is required" }),customerName: z.string().nullish().default(""),customerEmail: z.string().email().nullish().default(""),diff --git a/apps/web/lib/zod/schemas/leads.ts b/apps/web/lib/zod/schemas/leads.tsindex 51d1648867..69e2935131 100644--- a/apps/web/lib/zod/schemas/leads.ts+++ b/apps/web/lib/zod/schemas/leads.ts@@ -2,7 +2,6 @@ import z from "@/lib/zod";import { clickEventSchemaTB } from "./clicks";export const trackLeadRequestSchema = z.object({- workspaceId: z.string({ required_error: "workspaceId is required" }),clickId: z.string({ required_error: "clickId is required" }),eventName: z.string({ required_error: "eventName is required" })