Marketing Automation

Automating Affiliate Tracking, Attribution, and Partner Payouts with Dub

From partner click to payout: attribution and affiliate operations on autopilot.

DubAffiliate MarketingAttribution

By Troy Tessalone · · 10 minutes

Marketing Automation

A practical field guide from Automation Ace.

Short answer: to automate affiliate tracking, attribution, and partner payouts with Dub, set up a partner program with commission rules, give each partner tracked Dub links, record the click ID on your site, track leads at signup and sales at payment with Dub's API or a payment integration, and let Dub calculate commissions. Use Dub webhooks such as partner.enrolled, lead.created, sale.created, and commission.created (or the Zapier integration) to update your CRM, finance sheet, and Slack automatically, then review and pay partners from Dub on a schedule.

Webhook names, tracking fields, and payout options reflect Dub's documentation and integration pages at the time of writing; check current details and plan limits.

Short answer

  1. Program rules: commission, duration, approval, holding period.
  2. Partner links: one or more per partner.
  3. Tracking: click ID → lead → sale.
  4. Automation: webhooks or Zapier into CRM, finance, and Slack.
  5. Payouts: review, then pay on a schedule.

How attribution works in Dub

Click -> Lead -> Sale -> Commission -> Payout

1. Click     A visitor clicks a partner's Dub link; Dub records the click
             and your site stores the click ID (Dub's analytics script can
             set it in a first-party cookie).
2. Lead      On signup, your backend tracks a lead with the click ID and your
             customer's ID.
3. Sale      On payment, your backend (or a payment integration such as
             Stripe) tracks a sale for that customer ID with amount and currency.
4. Commission Dub calculates the partner's commission from your program rules.
5. Payout    You review and pay partners from Dub, on your schedule.

Link basics and naming: how to automate link management with Dub.

Step 1: Design the program

Program settingDecide
Commission typePercentage of sale or fixed amount per lead or sale
DurationFirst purchase only, a number of months, or lifetime
Attribution windowHow long after a click a conversion still counts
ApprovalAuto-approve partners or review applications
Holding periodDelay before commissions become payable, to cover refunds
Payout scheduleMonthly is common; set a minimum payout amount

For a real-world example of how a software affiliate program works, see does Zapier have an affiliate program?

Step 2: Give each partner tracked links

  • Create a default link per partner when they enroll (automate it from partner.enrolled).
  • Let partners create extra links to specific pages, with their own UTMs.
  • Use partner discount codes where your checkout supports them, synced via webhooks.

Step 3: Track leads and sales

// Server-side tracking sketch (Node.js, Dub SDK; check current method and field names)
import { Dub } from "dub";
const dub = new Dub({ token: process.env.DUB_API_KEY });

// On signup: read the click ID your site saved from the partner link
await dub.track.lead({
  clickId: req.cookies.dub_id,          // set by Dub's client-side analytics script
  eventName: "Sign Up",
  customerExternalId: user.id,
  customerEmail: user.email,
  customerName: user.name,
});

// On first payment (if you don't use a payment integration)
await dub.track.sale({
  customerExternalId: user.id,
  amount: 4900,                         // in cents
  currency: "usd",
  eventName: "Purchase",
  paymentProcessor: "stripe",
});
  • Client side: add Dub's analytics script so the click ID is stored when visitors arrive from a partner link.
  • Server side: track the lead with that click ID and your customer ID; track sales with the same customer ID.
  • Payment integrations: Dub can track sales from payment providers such as Stripe, so you may not need to call the sale endpoint yourself.

Step 4: Automate with webhooks and Zapier

Dub webhook eventFires whenAutomate
partner.enrolledA partner joins (approved application, accepted invite, or via API)Welcome email, onboarding tasks, add to CRM and Slack
lead.createdA lead is trackedCreate or update the CRM contact with partner attribution
sale.createdA sale is trackedUpdate deal value and source; notify the partner manager
commission.createdA commission is created (clawbacks arrive as negative amounts)Log to finance sheet; alert on large or negative amounts
link.clickedA link is clicked (scope to selected links)Engagement alerts for key partner links
discount_code.created / .deletedPartner discount codes changeSync codes to your store or checkout
Zap: Dub sale -> CRM -> finance -> Slack

Trigger   Dub: New sale (sale.created)          (or Catch Hook from a Dub webhook)
Step 1    HubSpot: find contact by customer email -> update "Partner source"
Step 2    HubSpot: update deal amount and stage
Step 3    Google Sheets: append to "Partner sales" (date, partner, amount, customer ID)
Step 4    Filter: amount > $1,000
Step 5    Slack: notify #partnerships with partner and deal details

Verify signatures and deduplicate deliveries; see duplicate webhooks and what a webhook is. Some events may only be available as webhooks set up in Dub, not as Zapier triggers.

Step 5: Review commissions and pay partners

  • Hold commissions until your refund window passes; clawbacks for refunds arrive as negative commissions.
  • Review a monthly payout batch: flag unusually large commissions or sudden spikes.
  • Pay partners from Dub on your schedule; check supported payout methods, fees, and limits for your plan.
  • Send each partner a payout summary automatically when the batch is paid.

Approval patterns for money movements: permissions, approvals, and audit trails.

Preventing bad data and fraud

  • Attribute on server-side events, not client-side alone.
  • Use unique customer IDs so one customer can't create duplicate sales.
  • Watch for self-referrals, coupon leaks, and traffic with no conversions.
  • Keep a holding period long enough to catch refunds and chargebacks.

Disclosure, tax, and terms

  • Require partners to disclose affiliate relationships as advertising rules require (such as the FTC's endorsement guidance in the US).
  • Collect any tax information your payouts require.
  • Publish clear program terms: commission, cookie or attribution window, prohibited promotion methods.

General information only, not legal or tax advice.

What to measure

  • Clicks, leads, and sales by partner; conversion rate per stage.
  • Revenue and commission per partner; cost of acquisition vs other channels.
  • Refund and clawback rate by partner.
  • Time from enrollment to first sale.

Baseline first: success metrics. CRM side: HubSpot workflows vs Zapier.

Frequently asked questions

How does Dub track affiliate conversions?

A visitor clicks a partner’s Dub link, your site stores the click ID, your backend tracks a lead with that click ID and your customer ID at signup, and tracks a sale for the same customer at payment, or a payment integration such as Stripe does it. Dub then attributes and calculates the commission.

What Dub webhooks are useful for affiliate programs?

partner.enrolled, lead.created, sale.created, and commission.created are the core ones, plus link.clicked for engagement and discount code events. commission.created also fires for clawbacks with a negative amount.

Can Dub pay affiliate partners automatically?

Dub lets you review commissions and pay partners from its dashboard on your schedule. Check current payout methods, fees, and plan limits, and keep a holding period for refunds.

How do I send Dub conversions to my CRM?

Use Dub’s Zapier integration or webhooks for lead.created and sale.created, find the contact by customer email, and update partner source, deal value, and stage. Verify webhook signatures and deduplicate deliveries.

What should an affiliate program include?

Clear commission rules, duration, an attribution window, partner approval, a holding period for refunds, a payout schedule, disclosure requirements for partners, and published terms.

DubAffiliate MarketingAttribution

Disclaimer: Dub features, API fields, webhook events, plans, and payout options change, and affiliate programs have disclosure and tax obligations that vary by location (this is not legal or tax advice); details reflect public documentation and coverage at the time of writing, so confirm current details with each provider before building. Automation Ace is not affiliated with Dub beyond the referral links marked on this page. This article may include links to apps, products, or services; some links may be affiliate links, which means Automation Ace may earn a commission at no extra cost to you.

Build Better Systems

Ready to automate with confidence?

Share your tools, process, and goals. Automation Ace can design the Zapier, AI, and automation setup that fits your business.

Start a Project →