Dub Conversions Overview

Learn how you can use Dub's Conversion Tracking feature to understand how well your links are converting to leads and sales.

Steven Tey

Written by Steven Tey

Dub Conversions is currently in closed beta and would require a Business plan subscription and above. If you'd like to join the beta, reach out to us via email.

Data is the lifeblood of any business. It helps you understand your customers, make data-driven decisions, and drive growth.

Whenever you run a marketing campaign, merely tracking link clicks is not sufficient to paint a complete picture of your customer acquisition funnel.

You need to track how those clicks are converting to signups & sales to be able to determine which campaigns/channels are performing the best.

This is where Dub Conversions comes in.

With Dub Conversions, you can turn any short link you create on Dub into a full attribution engine. This allows you to understand how well your links are translating to actual users and revenue dollars.

How does Dub Conversions work?

The way conversion tracking on Dub works can be boiled down to 3 simple steps:

This is the first step in the conversion funnel. It can either be:

  • A link click on a social media post/ad
  • A link click in an email/SMS
  • A QR code scan for physical (or video) campaigns

When a user performs an action that indicates interest in your product or service. This could be anything from:

  • Signing up for an account
  • Adding a product to cart
  • Joining a mailing list

When a user purchases your product or service. Examples include:

  • Subscribing to a paid plan
  • Usage expansion (upgrading from one plan to another)
  • Purchasing a product

With this 3-step process, marketing teams can make better decisions about which content or marketing efforts to invest more in – backed by real-world conversion data.

How are conversions tracked?

Dub Conversions uses a simple first-party cookie and server-side event tracking to track conversions.

When a user clicks on a conversion-enabled link, Dub generates a unique dub_id query parameter and stores it as a first-party cookie on your domain (e.g. .dub.co).

A diagram showing how click events are tracked in the conversion funnel
A diagram showing how click events are tracked in the conversion funnel

This allows Dub to attribute any subsequent conversion events to the original click – and by extension, the link that was clicked on.

To enable this, you need to install the @dub/analytics package in your project.

This package will handle the detection of the dub_id query parameter and storing it as a first-party cookie.

Step 2: Attributing conversion events to the original click

Then, when a conversion event occurs (e.g. a user signs up for an account), you can check for the dub_id cookie and attribute the conversion to the original click.

A diagram showing how lead events are tracked in the conversion funnel
A diagram showing how lead events are tracked in the conversion funnel

For example, if you're using a Next.js app with NextAuth for authentication, here's how you can send lead conversion events for new user signups.

When sending a lead conversion event, you can include the following properties:

PropertyDescriptionRequired
clickIdThe unique dub_id parameter that the lead conversion event is attributed to.Yes
eventNameThe name of the event. Example: "Sign up".Yes
customerIdThe unique ID of the customer in your system. Will be used to identify and attribute all future events to this customer.Yes
customerEmailThe email address of the customer. If not passed, a random email address will be generated.No
customerNameThe name of the customer. If not passed, a random name will be generated (e.g. "Big Red Caribou").No
customerAvatarThe avatar URL of the customer. If not passed, a random avatar URL will be generated.No

The lead event will serve as the source of truth for the customer's identity and which link they came from. This means that all subsequent actions performed by the customer (e.g. upgrading their plan, purchasing a product) will automatically be attributed to the original link.

Step 3: Sending sale events

The final step in the conversion funnel is to track sale events and attribute them to the original link click. This can be done in 2 ways:

A diagram showing how sale events are tracked in the conversion funnel
A diagram showing how sale events are tracked in the conversion funnel

Option 1: Stripe integration (recommended)

At Dub, we have a native Stripe integration that you can set up in 2-3 clicks and automatically send sale events to Dub.

The way the integration works is as follows:

  1. Connect your Stripe account to your Dub workspace (read-only access).
  2. When a user creates a checkout session on your app, pass the user's unique ID in your system as the dubCustomerId property in the metadata field.
  3. This way, when the user completes their checkout session, Dub will receive a webhook from Stripe containing the dubCustomerId.
  4. If the dubCustomerId matches a customer that came from a conversion-enabled link, Dub will track the sale as a result of that link.

Option 2: Manually sending sale events

Alternatively, if you prefer to send sale events manually, you can do so using our server-side SDKs.

We expose a POST /track/sale endpoint that you can use to send sale events to Dub. Here's an example using the Dub TypeScript SDK:

/api/billing/upgrade
import { Dub } from "dub";
 
const dub = new Dub();
 
await dub.track.sale({
  customerId: "123",
  amount: 5900, // in cents
  paymentProcessor: "stripe",
  eventName: "Subscription creation",
});

Here are the properties you can include when sending a sale event:

PropertyDescriptionRequired
customerIdThe unique ID of the customer in your system.Yes
amountThe amount of the sale in cents.Yes
paymentProcessorThe name of the payment processor that processed the sale.Yes
eventNameThe name of the event. Defaults to "Purchase".No
invoiceIdThe unique ID of the invoice in your system.No
currencyThe currency of the sale. Defaults to "usd".No
metadataAn object containing additional information about the sale.No

How do I see the conversions?

All your tracked conversions will show up on your Analytics dashboard. We provide 3 different views to help you understand your conversions:

Time-series line chart
Time-series line chart
  • Funnel chart: A funnel chart view visualizing the conversion & dropoff rates across the different steps in the conversion funnel (clicks → leads → sales).
Funnel chart view showing the conversion & dropoff rates from clicks → leads → sales
Funnel chart view showing the conversion & dropoff rates from clicks → leads → sales
  • Real-time events stream: A real-time events stream of every single conversion event that occurs across all your links in your workspace.
The Events Stream dashboard on Dub
The Events Stream dashboard on Dub

What can I build with Dub Conversions?

There are various use cases for Dub Conversions. Here are a few examples:

1. White-labeled affiliate/referral programs

You can use Dub Conversions to track how well your affiliate/referral links are performing and display the real-time analytics directly inside your application – using our Analytics API.

For instance, here's a screenshot of our very own Dub referral program – powered by Dub Conversions – that lives directly inside the Dub dashboard:

A demo of the Dub Referrals dashboard

Dub Conversions also comes with webhooks that lets you do stuff like:

  • refer a friend and both of you get 1-month free (2-sided incentives)
  • send a swag link when a user reaches $1,000 in referred revenue

In the future, we're also planning to support 1-click payouts as well.

2. Paid ads attribution tracking

Dub Conversions lets you understand the performance of your ads – not just the number of clicks, but also the number of signups and upgrades. You can then use the data to make data-driven decisions about which ads to spend on and where to allocate your budget.

3. Tracking product-led growth

By integrating Dub Conversions into your product, you can measure how many new users (and upgrades) each existing user brings in – also known as the app's K-factor or the "viral coefficient formula".

Getting started with Dub Conversions

To get started with Dub Conversions, check out our quickstart guide.

View guide ↗

Dub Conversions quickstart guide

Did this answer your question?