Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

add manual track lead and sales

Kiran K8e426afed44b
diff --git a/apps/web/integration-guides/manual-track-leads.md b/apps/web/integration-guides/manual-track-leads.md
index 5ab2f8a432..7c1978bb46 100644
--- a/apps/web/integration-guides/manual-track-leads.md
+++ b/apps/web/integration-guides/manual-track-leads.md
@@ -1 +1,26 @@
-Hello
\ No newline at end of file
+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/integration-guides/manual-track-sales.md b/apps/web/integration-guides/manual-track-sales.md
index e69de29bb2..8579b84252 100644
--- a/apps/web/integration-guides/manual-track-sales.md
+++ b/apps/web/integration-guides/manual-track-sales.md
@@ -0,0 +1,27 @@
+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,
+ 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/integration-guides/rest-api.md b/apps/web/integration-guides/rest-api.md
index ea8af0899a..4bf4da9940 100644
--- a/apps/web/integration-guides/rest-api.md
+++ b/apps/web/integration-guides/rest-api.md
@@ -26,5 +26,3 @@ const response = await fetch("https://api.dub.co/links", {
const data = await response.json();
```
-
-You can see the full API reference [here](https://dub.co/docs/api-reference/introduction).
diff --git a/apps/web/ui/guides/guide.tsx b/apps/web/ui/guides/guide.tsx
index c4e9b2b9e7..79e5058b3b 100644
--- a/apps/web/ui/guides/guide.tsx
+++ b/apps/web/ui/guides/guide.tsx
@@ -57,7 +57,7 @@ export function Guide({ markdown }: { markdown: string }) {
}
onClick={() => {
copyGuideUrl(selectedGuide.url);
- toast.success("Copied guide link to clipboard.");
+ toast.success("Link copied to clipboard.");
}}
/>
</div>
diff --git a/apps/web/ui/guides/integrations.ts b/apps/web/ui/guides/integrations.ts
index eb4689ea63..97bdbb32e8 100644
--- a/apps/web/ui/guides/integrations.ts
+++ b/apps/web/ui/guides/integrations.ts
@@ -15,7 +15,7 @@ import { Supabase } from "@/ui/layout/sidebar/conversions/icons/supabase";
import { Typescript } from "@/ui/layout/sidebar/conversions/icons/typescript";
import { Webflow } from "@/ui/layout/sidebar/conversions/icons/webflow";
import { Wordpress } from "@/ui/layout/sidebar/conversions/icons/wordpress";
-import { SquareCode } from "lucide-react";
+import { CodeEditor } from "../layout/sidebar/conversions/icons/code-editor";
export type IntegrationType =
| "client-sdk"
@@ -106,7 +106,7 @@ export const guides: IntegrationGuide[] = [
type: "client-sdk",
key: "manual-client-sdk",
title: "Manual",
- icon: SquareCode,
+ icon: CodeEditor,
url: "https://dub.co/docs/sdks/client-side/installation-guides/manual",
},
@@ -150,7 +150,7 @@ export const guides: IntegrationGuide[] = [
type: "server-sdk",
key: "rest-api",
title: "REST API",
- icon: SquareCode,
+ icon: CodeEditor,
url: "https://dub.co/docs/api-reference/introduction",
},
@@ -201,8 +201,8 @@ export const guides: IntegrationGuide[] = [
type: "track-leads",
key: "manual-track-leads",
title: "Manual",
- icon: SquareCode,
- url: "https://dub.co/docs/conversions/leads/manual", // fix this
+ icon: CodeEditor,
+ url: "https://dub.co/docs/api-reference/endpoint/track-lead",
},
// {
// type: "track-leads",
@@ -240,8 +240,8 @@ export const guides: IntegrationGuide[] = [
type: "track-sales",
key: "manual-track-sales",
title: "Manual",
- icon: SquareCode,
- url: "https://dub.co/docs/conversions/sales/manual", // fix this
+ icon: CodeEditor,
+ url: "https://dub.co/docs/api-reference/endpoint/track-sale",
},
// {
// type: "track-sales",
diff --git a/apps/web/ui/layout/sidebar/conversions/icons/code-editor.tsx b/apps/web/ui/layout/sidebar/conversions/icons/code-editor.tsx
new file mode 100644
index 0000000000..1e6de6aa3b
--- /dev/null
+++ b/apps/web/ui/layout/sidebar/conversions/icons/code-editor.tsx
@@ -0,0 +1,56 @@
+import { SVGProps } from "react";
+
+export function CodeEditor(props: SVGProps<SVGSVGElement>) {
+ return (
+ <svg
+ width="36"
+ height="32"
+ viewBox="0 0 36 32"
+ fill="none"
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <path
+ d="M6.33355 29.8892L29.6669 29.8892C32.1215 29.8892 34.1113 27.8993 34.1113 25.4447V6.55583C34.1113 4.10123 32.1215 2.11138 29.6669 2.11138L6.33355 2.11138C3.87895 2.11138 1.88911 4.10123 1.88911 6.55583V25.4447C1.88911 27.8993 3.87895 29.8892 6.33355 29.8892Z"
+ stroke="#404040"
+ stroke-width="2.5"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ />
+ <path
+ d="M9.66699 2.11133V29.8891"
+ stroke="#404040"
+ stroke-width="2.5"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ />
+ <path
+ d="M21.8887 18.7778H28.5553"
+ stroke="#404040"
+ stroke-width="2.5"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ />
+ <path
+ d="M18.5557 13.2227H24.6668"
+ stroke="#404040"
+ stroke-width="2.5"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ />
+ <path
+ d="M18.5557 24.3335H23.0001"
+ stroke="#404040"
+ stroke-width="2.5"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ />
+ <path
+ d="M15.2227 7.66699H18.556"
+ stroke="#404040"
+ stroke-width="2.5"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ />
+ </svg>
+ );
+}