The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
finalize guides
Steven Teya63e538b6f5a
diff --git a/apps/web/guides/manual-track-lead.md b/apps/web/guides/manual-track-lead.mdnew file mode 100644index 0000000000..197ff26667--- /dev/null+++ b/apps/web/guides/manual-track-lead.md@@ -0,0 +1,56 @@+You can also use Dub's [server-side SDKs](https://dub.co/docs/sdks/overview) or [REST API](https://dub.co/docs/api-reference/introduction) to track a lead event manually.++The example below demonstrates how to track a lead using the [Dub TypeScript SDK](https://dub.co/docs/sdks/typescript) in Node.js.++```typescript+import { Dub } from "dub";++const dub = new Dub({+ // optional, defaults to the DUB_API_KEY environment variable+ token: process.env.DUB_API_KEY,+});++await dub.track.lead({+ clickId: "rLnWe1uz9t282v7g",+ eventName: "Sign up",+ externalId: "cus_oFUYbZYqHFR0knk0MjsMC6b0",+ customerName: "John Doe",+ customerEmail: "[email protected]",+ customerAvatar: "https://example.com/avatar.png",+});+```++If you want to use the REST API instead, you can refer to the following example:++```javascript+const response = await fetch("https://api.dub.co/track/lead", {+ method: "POST",+ headers: {+ Authorization: "Bearer dub_xxxxxx",+ "Content-Type": "application/json",+ },+ body: JSON.stringify({+ clickId: "rLnWe1uz9t282v7g",+ eventName: "Sign up",+ externalId: "cus_oFUYbZYqHFR0knk0MjsMC6b0",+ customerName: "John Doe",+ customerEmail: "[email protected]",+ customerAvatar: "https://example.com/avatar.png",+ }),+});++const data = await response.json();+```++Make sure to include your API key in the Authorization header and pass the relevant lead data in the request body as JSON.++---++Refer to the [track lead API reference](https://dub.co/docs/api-reference/endpoint/track-lead) for details on available parameters and response formats.++Dub also supports server-side SDKs for other languages, including:++- [Python](https://dub.co/docs/sdks/python)+- [PHP](https://dub.co/docs/sdks/php)+- [Ruby](https://dub.co/docs/sdks/ruby)+- [Go](https://dub.co/docs/sdks/go)diff --git a/apps/web/guides/manual-track-leads.md b/apps/web/guides/manual-track-leads.mddeleted file mode 100644index 7c1978bb46..0000000000--- a/apps/web/guides/manual-track-leads.md+++ /dev/null@@ -1,26 +0,0 @@-If you prefer not to use the SDK, you can interact directly with Dub’s REST API to track leads.--The example below demonstrates how to track a lead using a POST request in Node.js.--Make sure to include your API key in the Authorization header and pass the relevant lead data in the request body as JSON.--```javascript-const response = await fetch("https://api.dub.co/track/lead", {- method: "POST",- headers: {- Authorization: "Bearer dub_xxxxxx",- "Content-Type": "application/json",- },- body: JSON.stringify({- clickId: "rLnWe1uz9t282v7g",- eventName: "Sign up",- externalId: "cus_oFUYbZYqHFR0knk0MjsMC6b0",- customerName: "John Doe",- customerEmail: "[email protected]",- }),-});--const data = await response.json();-```--Refer to the [API reference](https://dub.co/docs/api-reference/endpoint/track-lead) for details on available parameters and response formats.diff --git a/apps/web/guides/manual-track-sale.md b/apps/web/guides/manual-track-sale.mdnew file mode 100644index 0000000000..d606fcfa0b--- /dev/null+++ b/apps/web/guides/manual-track-sale.md@@ -0,0 +1,56 @@+You can also use Dub's [server-side SDKs](https://dub.co/docs/sdks/overview) or [REST API](https://dub.co/docs/api-reference/introduction) to track a sale event manually.++The example below demonstrates how to track a sale using the [Dub TypeScript SDK](https://dub.co/docs/sdks/typescript) in Node.js.++```typescript+import { Dub } from "dub";++const dub = new Dub({+ // optional, defaults to the DUB_API_KEY environment variable+ token: process.env.DUB_API_KEY,+});++await dub.track.sale({+ externalId: "cus_oFUYbZYqHFR0knk0MjsMC6b0",+ amount: 3000, // sale amount in cents+ paymentProcessor: "stripe",+ eventName: "Invoice paid",+ invoiceId: "INV_1234567890",+ currency: "usd",+});+```++If you want to use the REST API instead, you can refer to the following example:++```javascript+const response = await fetch("https://api.dub.co/track/sale", {+ method: "POST",+ headers: {+ Authorization: "Bearer dub_xxxxxx",+ "Content-Type": "application/json",+ },+ body: JSON.stringify({+ externalId: "cus_oFUYbZYqHFR0knk0MjsMC6b0",+ amount: 3000, // sale amount in cents+ paymentProcessor: "stripe",+ eventName: "Invoice paid",+ invoiceId: "INV_1234567890",+ currency: "usd",+ }),+});++const data = await response.json();+```++Make sure to include your API key in the Authorization header and pass the relevant sale data in the request body as JSON.++---++Refer to the [track sale API reference](https://dub.co/docs/api-reference/endpoint/track-sale) for details on available parameters and response formats.++Dub also supports server-side SDKs for other languages, including:++- [Python](https://dub.co/docs/sdks/python)+- [PHP](https://dub.co/docs/sdks/php)+- [Ruby](https://dub.co/docs/sdks/ruby)+- [Go](https://dub.co/docs/sdks/go)diff --git a/apps/web/guides/manual-track-sales.md b/apps/web/guides/manual-track-sales.mddeleted file mode 100644index 51fee9e2bb..0000000000--- a/apps/web/guides/manual-track-sales.md+++ /dev/null@@ -1,27 +0,0 @@-If you prefer not to use the SDK, you can interact directly with Dub’s REST API to track sales.--The example below demonstrates how to track a sale using a POST request in Node.js.--Make sure to include your API key in the Authorization header and pass the relevant sale data in the request body as JSON.--```javascript-const response = await fetch("https://api.dub.co/track/sale", {- method: "POST",- headers: {- Authorization: "Bearer dub_xxxxxx",- "Content-Type": "application/json",- },- body: JSON.stringify({- externalId: "cus_oFUYbZYqHFR0knk0MjsMC6b0",- amount: 3000, // sale amount in cents- paymentProcessor: "custom",- eventName: "Invoice paid",- invoiceId: "INV_1234567890",- currency: "usd",- }),-});--const data = await response.json();-```--Refer to the [API reference](https://dub.co/docs/api-reference/endpoint/track-sale) for details on available parameters and response formats.diff --git a/apps/web/ui/guides/guide-list.tsx b/apps/web/ui/guides/guide-list.tsxindex 31ebe0c85b..b28fbf59da 100644--- a/apps/web/ui/guides/guide-list.tsx+++ b/apps/web/ui/guides/guide-list.tsx@@ -129,7 +129,7 @@ export function GuideList() {}}/>- {["track-leads", "track-sales"].includes(section.type) && (+ {["track-lead", "track-sale"].includes(section.type) && (<p className="flex items-center justify-center gap-2 text-center text-sm font-medium leading-5 text-neutral-500"><Shopify className="inline size-4" />If you're using Shopify, you can skip this step.{" "}diff --git a/apps/web/ui/guides/guide.tsx b/apps/web/ui/guides/guide.tsxindex db8ce0a7c9..9464a870da 100644--- a/apps/web/ui/guides/guide.tsx+++ b/apps/web/ui/guides/guide.tsx@@ -9,8 +9,8 @@ import { Markdown } from "./markdown";const integrationTypeToTitle: Record<IntegrationType, string> = {"client-sdk": "Install client-side script",- "track-leads": "Track lead events",- "track-sales": "Track sale events",+ "track-lead": "Track lead events",+ "track-sale": "Track sale events",};export function Guide({ markdown }: { markdown: string }) {diff --git a/apps/web/ui/guides/integrations.ts b/apps/web/ui/guides/integrations.tsindex f33a626e89..0c4f935bf6 100644--- a/apps/web/ui/guides/integrations.ts+++ b/apps/web/ui/guides/integrations.ts@@ -12,7 +12,7 @@ import { Webflow } from "@/ui/layout/sidebar/conversions/icons/webflow";import { Wordpress } from "@/ui/layout/sidebar/conversions/icons/wordpress";import { CodeEditor } from "../layout/sidebar/conversions/icons/code-editor";-export type IntegrationType = "client-sdk" | "track-leads" | "track-sales";+export type IntegrationType = "client-sdk" | "track-lead" | "track-sale";export type IntegrationGuide = {type: IntegrationType;@@ -38,13 +38,13 @@ export const sections: {"First, you need to install Dub's client-side script, which enables Dub to track click events and store them as a first-party cookie on your site.",},{- type: "track-leads",+ type: "track-lead",title: "Track lead events",description:"Then, you'll track a lead event (e.g. when a user signs up for an account on your application) using our server-side SDKs or REST API.",},{- type: "track-sales",+ type: "track-sale",title: "Track sale events",description:"Finally, you can use our Stripe integration or server-side SDKs to track sale events (e.g. when a user purchases a product on your application).",@@ -99,65 +99,65 @@ export const guides: IntegrationGuide[] = [// Track Leads{- type: "track-leads",+ type: "track-lead",key: "clerk",title: "Clerk",icon: Clerk,url: "https://dub.co/docs/conversions/leads/clerk",},{- type: "track-leads",+ type: "track-lead",key: "better-auth",title: "Better Auth",icon: BetterAuth,url: "https://dub.co/docs/conversions/leads/better-auth",},{- type: "track-leads",+ type: "track-lead",key: "next-auth",title: "NextAuth.js",icon: NextAuth,url: "https://dub.co/docs/conversions/leads/next-auth",},{- type: "track-leads",+ type: "track-lead",key: "supabase",title: "Supabase",icon: Supabase,url: "https://dub.co/docs/conversions/leads/supabase",},{- type: "track-leads",+ type: "track-lead",key: "auth0",title: "Auth0",icon: Auth0,url: "https://dub.co/docs/conversions/leads/auth0",},{- type: "track-leads",+ type: "track-lead",key: "appwrite",title: "Appwrite",icon: Appwrite,url: "https://dub.co/docs/conversions/leads/appwrite",},{- type: "track-leads",- key: "manual-track-leads",+ type: "track-lead",+ key: "manual-track-lead",title: "Custom Integration",description: "Manual Lead Tracking",icon: CodeEditor,url: "https://dub.co/docs/conversions/leads/introduction",},// {- // type: "track-leads",- // key: "segment-track-leads",+ // type: "track-lead",+ // key: "segment-track-lead",// title: "Segment",// icon: Segment,// },// Track Sales{- type: "track-sales",+ type: "track-sale",key: "stripe-checkout",title: "Stripe",subtitle: "Checkout",@@ -167,7 +167,7 @@ export const guides: IntegrationGuide[] = [url: "https://dub.co/docs/conversions/sales/stripe#option-2%3A-using-stripe-checkout-recommended",},{- type: "track-sales",+ type: "track-sale",key: "stripe-payment-links",title: "Stripe",subtitle: "Payment Links",@@ -176,7 +176,7 @@ export const guides: IntegrationGuide[] = [url: "https://dub.co/docs/conversions/sales/stripe#option-1%3A-using-stripe-payment-links",},{- type: "track-sales",+ type: "track-sale",key: "stripe-customers",title: "Stripe",subtitle: "Customers",@@ -185,16 +185,16 @@ export const guides: IntegrationGuide[] = [url: "https://dub.co/docs/conversions/sales/stripe#option-3%3A-using-stripe-customers",},{- type: "track-sales",- key: "manual-track-sales",+ type: "track-sale",+ key: "manual-track-sale",title: "Custom Integration",description: "Manual Sale Tracking",icon: CodeEditor,url: "https://dub.co/docs/conversions/sales/introduction",},// {- // type: "track-sales",- // key: "segment-track-sales",+ // type: "track-sale",+ // key: "segment-track-sale",// title: "Segment",// icon: Segment,// },