Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions conversions/leads/client-side.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
title: Client-side tracking
og:title: Client-side lead tracking with Dub
description: Learn how to track lead conversion events with Dub using client-side tracking
---

import LeadsIntro from "/snippets/leads-intro.mdx";
import ClientSideLeadTracking from "/snippets/client-side-lead-tracking.mdx";
import ClientSideTrackingInstall from "/snippets/client-side-tracking-install.mdx";
import LeadsOutro from "/snippets/leads-outro.mdx";

<LeadsIntro />

## Prerequisites

Before you get started, make sure you follow the [Dub Conversions quickstart guide](/conversions/quickstart) to get Dub Conversions set up for your links:

1. [Enable conversion tracking for your links](/conversions/quickstart#step-1%3A-enable-conversion-tracking-for-your-links)

<ClientSideTrackingInstall />

## Client-side lead tracking

<ClientSideLeadTracking />

<Warning>
Client-side conversion tracking comes with some limitations: - **Ad
blockers**: Users with ad blockers may prevent tracking scripts from loading -
**JavaScript disabled**: Events won't be tracked if users have JavaScript
disabled - **Network issues**: Failed network requests won't retry
automatically - **Privacy concerns**: Some users may block client-side
tracking for privacy reasons For more accurate conversion tracking, consider
using [server-side conversion tracking](/api-reference/endpoint/track-lead).
</Warning>

<LeadsOutro />
7 changes: 4 additions & 3 deletions conversions/leads/introduction.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
---
title: "Introduction"
og:title: "How to track lead conversion events with Dub"
description: "Learn how to track lead conversion events with Dub"
title: Server-side tracking
sidebarTitle: Server-side tracking (recommended)
og:title: Server-side lead tracking with Dub
description: Learn how to track lead conversion events with Dub using server-side tracking
---

import LeadsIntro from "/snippets/leads-intro.mdx";
Expand Down
21 changes: 9 additions & 12 deletions conversions/quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ import DubClientInstall from "/snippets/dub-client-install.mdx";
import DubClientInstallVerify from "/snippets/dub-client-install-verify.mdx";
import InstallServerSdksTrackConversions from "/snippets/install-server-sdks-track-conversions.mdx";
import ViewConversions from "/snippets/view-conversions.mdx";
import DubConversionTrackingDemoApps from "/snippets/dub-conversion-tracking-demo-apps.mdx";

<Note>
Conversion tracking require a [Business plan](https://dub.co/pricing)
subscription or higher.
</Note>

[Dub Conversions](https://dub.co/help/article/dub-conversions) is a powerful tool that lets you turn any [short link you create on Dub](https://dub.co/help/article/how-to-create-link) into a full attribution engine. This allows you to understand how well your links are translating to actual users and revenue dollars.
Dub's powerful [attribution platform](https://dub.co/analytics) lets you understand how well your links are translating to actual users and revenue dollars.

<Frame>
<img
Expand All @@ -23,7 +24,7 @@ import ViewConversions from "/snippets/view-conversions.mdx";
/>
</Frame>

In this guide, we'll walk you through the steps to get started with Dub Conversions:
In this guide, we'll walk you through the steps to get started with [conversion tracking on Dub](https://dub.co/help/article/dub-conversions):

1. [Enable conversion tracking for your links](#step-1%3A-enable-conversion-tracking-for-your-links)
2. [Install the `@dub/analytics` client-side SDK](#step-2-install-the-dub-analytics-client-side-sdk)
Expand All @@ -32,6 +33,11 @@ In this guide, we'll walk you through the steps to get started with Dub Conversi

## Step 1: Enable conversion tracking for your links

<Tip>
If you're using [Dub Partners](/partners/quickstart), you can skip this step
since partner links will have conversion tracking enabled by default.
</Tip>

First, you'll need to enable conversion tracking for your Dub links to be able to start tracking conversions.

There are a few ways to do this:
Expand Down Expand Up @@ -139,13 +145,4 @@ Once you've enabled conversion tracking for your links, all your tracked convers

## Example Apps

<CardGroup cols={2}>
<Card
title="Dub Conversions Demo App"
icon="github"
href="https://github.com/dubinc/examples/tree/main/conversions/stripe"
color="#333333"
>
See the full example on GitHub.
</Card>
</CardGroup>
<DubConversionTrackingDemoApps />
42 changes: 42 additions & 0 deletions conversions/sales/client-side.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
title: Client-side tracking
og:title: Client-side sale tracking with Dub
description: Learn how to track sales conversion events with Dub on the client-side
---

import ClientSideTrackingInstall from "/snippets/client-side-tracking-install.mdx";
import ViewConversions from "/snippets/view-conversions.mdx";
import ClientSideSaleTracking from "/snippets/client-side-sale-tracking.mdx";

When it comes to [conversion tracking](/conversions/quickstart), a `sale` event happens when a user purchases your product or service. Examples include:

- Subscribing to a paid plan
- Usage expansion (upgrading from one plan to another)

## Prerequisites

Before you get started, make sure you follow the [Dub Conversions quickstart guide](/conversions/quickstart) to get Dub Conversions set up for your links:

1. [Enable conversion tracking for your links](/conversions/quickstart#step-1%3A-enable-conversion-tracking-for-your-links)

<ClientSideTrackingInstall />

## Client-side sale tracking

<ClientSideSaleTracking />

<Warning>
Client-side conversion tracking comes with some limitations: - **Ad
blockers**: Users with ad blockers may prevent tracking scripts from loading -
**JavaScript disabled**: Events won't be tracked if users have JavaScript
disabled - **Network issues**: Failed network requests won't retry
automatically - **Privacy concerns**: Some users may block client-side
tracking for privacy reasons For more accurate conversion tracking, consider
using [server-side conversion tracking](/api-reference/endpoint/track-sale).
</Warning>

## View conversion results

And that's it – you're all set! You can now sit back, relax, and watch your conversion revenue grow. We provide 3 different views to help you understand your conversions:

<ViewConversions />
7 changes: 4 additions & 3 deletions conversions/sales/introduction.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
---
title: "Introduction"
og:title: "How to track sale conversion events with Dub"
description: "Learn how to track sales conversion events with Dub"
title: Server-side tracking
sidebarTitle: Server-side tracking (recommended)
og:title: Server-side sale tracking with Dub
description: Learn how to track sales conversion events with Dub using server-side tracking
---

import SalesPrerequisites from "/snippets/sales-prerequisites.mdx";
Expand Down
51 changes: 30 additions & 21 deletions docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,24 +61,29 @@
"group": "Tracking lead events",
"pages": [
"conversions/leads/introduction",
"conversions/leads/clerk",
"conversions/leads/better-auth",
"conversions/leads/next-auth",
"conversions/leads/supabase",
"conversions/leads/auth0",
"conversions/leads/appwrite",
"conversions/leads/segment",
"conversions/leads/google-tag-manager"
"conversions/leads/client-side",
{
"group": "Auth providers",
"pages": [
"conversions/leads/clerk",
"conversions/leads/better-auth",
"conversions/leads/next-auth",
"conversions/leads/supabase",
"conversions/leads/auth0",
"conversions/leads/appwrite"
]
},
"conversions/leads/segment"
]
},
{
"group": "Tracking sale events",
"pages": [
"conversions/sales/introduction",
"conversions/sales/client-side",
"conversions/sales/stripe",
"conversions/sales/shopify",
"conversions/sales/segment",
"conversions/sales/google-tag-manager"
"conversions/sales/segment"
]
}
]
Expand Down Expand Up @@ -153,8 +158,8 @@
{
"group": "Features",
"pages": [
"sdks/client-side/features/click-tracking",
"sdks/client-side/features/conversion-tracking",
"sdks/client-side/features/client-side-click-tracking",
"sdks/client-side/features/cross-domain-tracking",
"sdks/client-side/features/reverse-proxy-support"
]
Expand Down Expand Up @@ -227,6 +232,16 @@
"api-reference/endpoint/update-a-commission"
]
},
{
"group": "Domains API",
"pages": [
"api-reference/endpoint/create-a-domain",
"api-reference/endpoint/update-a-domain",
"api-reference/endpoint/delete-a-domain",
"api-reference/endpoint/register-a-domain",
"api-reference/endpoint/check-a-domain-availability"
]
},
{
"group": "Folders API",
"pages": [
Expand All @@ -243,16 +258,6 @@
"api-reference/endpoint/retrieve-a-list-of-tags",
"api-reference/endpoint/update-a-tag"
]
},
{
"group": "Domains API",
"pages": [
"api-reference/endpoint/create-a-domain",
"api-reference/endpoint/update-a-domain",
"api-reference/endpoint/delete-a-domain",
"api-reference/endpoint/register-a-domain",
"api-reference/endpoint/check-a-domain-availability"
]
}
]
}
Expand Down Expand Up @@ -322,6 +327,10 @@
"source": "/sdks/js-client/overview",
"destination": "/sdks/client-side/installation-guides/react"
},
{
"source": "/sdks/client-side/features/client-side-click-tracking",
"destination": "/sdks/client-side/features/click-tracking"
},
Comment on lines +331 to +333
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Redirect for renamed click-tracking — add redirects for removed GTM lead/sale pages.
Consider adding redirects for removed GTM pages to prevent 404s; destination can be the GTM install guide (most intent-preserving).

   {
     "source": "/sdks/client-side/features/client-side-click-tracking",
     "destination": "/sdks/client-side/features/click-tracking"
   },
+  {
+    "source": "/conversions/leads/google-tag-manager",
+    "destination": "/sdks/client-side/installation-guides/google-tag-manager"
+  },
+  {
+    "source": "/conversions/sales/google-tag-manager",
+    "destination": "/sdks/client-side/installation-guides/google-tag-manager"
+  },

If you prefer, we can instead point those to the new client-side lead/sale pages.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"source": "/sdks/client-side/features/client-side-click-tracking",
"destination": "/sdks/client-side/features/click-tracking"
},
"source": "/sdks/client-side/features/client-side-click-tracking",
"destination": "/sdks/client-side/features/click-tracking"
},
{
"source": "/conversions/leads/google-tag-manager",
"destination": "/sdks/client-side/installation-guides/google-tag-manager"
},
{
"source": "/conversions/sales/google-tag-manager",
"destination": "/sdks/client-side/installation-guides/google-tag-manager"
},
🤖 Prompt for AI Agents
In docs.json around lines 331 to 333, the redirect for the renamed
click-tracking path is present but we need to also add redirects for the removed
GTM lead and GTM sale pages to avoid 404s; add entries mapping the old GTM lead
and GTM sale source paths to appropriate destinations (either the GTM install
guide or the new client-side lead/sale pages), ensuring the JSON array of
redirects includes those objects with "source" and "destination" keys and valid
paths and that the file remains syntactically valid (commas and brackets
correct).

{
"source": "/self-hosting/guide",
"destination": "/self-hosting"
Expand Down
14 changes: 3 additions & 11 deletions examples.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ title: "What can you build with Dub?"
description: "Explore ideas and examples of what you can build with the Dub API"
---

import DubConversionTrackingDemoApps from "/snippets/dub-conversion-tracking-demo-apps.mdx";

## Dub Links

With Dub's [API](/api-reference/introduction), you can integrate Dub's link infrastructure into your application. This includes use cases like:
Expand Down Expand Up @@ -57,14 +59,4 @@ You can also combine Dub Conversions with [Webhooks](/concepts/webhooks/introduc
- give both the referrer and referee 1 month free of your product
- send a swag link when a user reaches 5 referrals

<CardGroup cols={2}>
<Card
title="Dub Conversions Demo App"
icon="github"
href="https://github.com/dubinc/examples/tree/main/conversions/stripe"
color="#333333"
>
Example app that shows how to use Dub Conversions with the Dub Typescript
SDK
</Card>
</CardGroup>
<DubConversionTrackingDemoApps />
Binary file modified images/conversions/allowed-hostnames.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/conversions/publishable-key.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Client-side click-tracking
title: Client-side click tracking
description: Track clicks on the client-side using query parameters
---

Expand Down
19 changes: 17 additions & 2 deletions sdks/client-side/features/conversion-tracking.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
---
title: Conversion-tracking
description: Learn how to use the @dub/analytics script to track conversion events
title: Client-side conversion tracking
sidebarTitle: Conversion tracking
description: Learn how to use the @dub/analytics script to track conversion events on the client-side
---

import ClientSideTrackingInstall from "/snippets/client-side-tracking-install.mdx";
import ClientSideLeadTracking from "/snippets/client-side-lead-tracking.mdx";
import ClientSideSaleTracking from "/snippets/client-side-sale-tracking.mdx";

`@dub/analytics` is a client-side script for [tracking conversion events](/conversions/quickstart) with Dub.

By default, the script handles the detection of the `dub_id` query parameter and storing it as a first-party cookie:
Expand Down Expand Up @@ -34,3 +39,13 @@ Finally, when the user completes a purchase (e.g. subscribing to a plan, purchas
alt="A diagram showing how sale events are tracked in the conversion funnel"
/>
</Frame>

<ClientSideTrackingInstall />

## Client-side lead tracking

<ClientSideLeadTracking />

## Client-side sale tracking

<ClientSideSaleTracking />
Loading