The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Update track-lead.ts
Steven Tey7226515e6deb
diff --git a/apps/web/lib/auth/track-lead.ts b/apps/web/lib/auth/track-lead.tsindex 6141a74716..bba9731f94 100644--- a/apps/web/lib/auth/track-lead.ts+++ b/apps/web/lib/auth/track-lead.ts@@ -1,3 +1,4 @@+import { dub } from "@/lib/dub";import { User } from "next-auth";import { cookies } from "next/headers";@@ -10,29 +11,15 @@ export const trackLead = async (user: User) => {return;}- // dub.track.lead({- // clickId,- // eventName: "Sign Up",- // customerId: user.id,- // customerName: user.name,- // customerEmail: user.email,- // customerAvatar: user.image,- // }),- await fetch("https://api.dub.co/track/lead", {- method: "POST",- headers: {- Authorization: `Bearer ${process.env.DUB_API_KEY}`,- "Content-Type": "application/json",- },- body: JSON.stringify({- clickId,- eventName: "Sign Up",- customerId: user.id,- customerName: user.name,- customerEmail: user.email,- customerAvatar: user.image,- }),- }).then((res) => res.json());+ // send the lead event to Dub+ await dub.track.lead({+ clickId,+ eventName: "Sign Up",+ customerId: user.id,+ customerName: user.name,+ customerEmail: user.email,+ customerAvatar: user.image,+ });// delete the clickId cookiecookies().delete("dclid");