How to Build a Scalable Affiliate Program with Dub Attribution

Dub is a link attribution platform that processed [$10 million in partner payouts within six months](https://martech.zone/dub-stop-guessing-and-start-scaling-your-revenue-with-attribution-and-affiliate-growth/) of launching its affiliate management layer — a milestone that signals a fundamental shif


0

Dub is a link attribution platform that processed $10 million in partner payouts within six months of launching its affiliate management layer — a milestone that signals a fundamental shift in how SaaS companies instrument their growth programs. If your current affiliate stack relies on client-side tracking pixels, you are already operating with incomplete data. This tutorial walks you through how Dub replaces fragmented legacy tools with server-side attribution, automated global payouts, and a partner growth engine that scales to 100,000 affiliates without a spreadsheet in sight.


What This Is

Dub is a modern link management and attribution platform that unifies three capabilities that most teams currently bolt together from separate vendors: short link infrastructure, real-time analytics, and full-cycle affiliate program management. The platform is purpose-built for SaaS companies and developer-forward teams that need a precise picture of revenue attribution — not just click counts, but actual closed deals tied to specific partners and campaigns.

The core technical differentiation is server-side tracking. Where traditional affiliate and UTM-based tracking fires JavaScript pixels in the user’s browser, Dub captures the click event at the server level before the page even loads. This matters because standard ad blockers — used by an estimated 40%+ of desktop users — routinely suppress client-side tracking calls. With server-side capture, that data loss disappears.

Here is how the attribution flow works across three distinct stages, as documented in the Dub platform briefing:

Stage 1 — Click: When a user clicks a Dub short link, the platform captures the event server-side and appends a unique dub_id parameter to the session. This ID is stored as a first-party cookie with a 90-day default expiration. Because it is first-party and server-assigned, it survives browser refreshes, tab closures, and ad blocker rules.

Stage 2 — Lead: When the user completes a qualifying action — signing up for a trial, requesting a demo, or any custom conversion event you define — Dub ties that action back to the originating dub_id. The platform automatically deduplicates based on customer IDs, so you do not double-count leads from returning users.

Stage 3 — Sale: When a purchase completes (via Stripe, Shopify, or custom webhooks), Dub walks back through its attribution chain to match the sale to the originating lead and click. Commission calculations run automatically against whatever reward rules you have configured.

The analytics layer includes a natural language query interface called Ask AI, which lets non-technical users generate custom reports by typing plain-English queries such as “show me North America sales in Q1 2025.” This removes the bottleneck of having analysts write custom SQL or configure complex dashboard filters every time a campaign manager wants a cut of the data.

Beyond analytics, Dub Partners is the affiliate management module. It handles recruiting, onboarding, tracking, and paying creators, influencers, and customers who refer new business. The platform currently supports programs with up to 100,000 active partners and handles tens of millions of conversion events at any given time. Native SDKs are available for TypeScript, Python, Go, PHP, and Ruby, with sub-150ms request latency according to Dub’s platform documentation.


Why It Matters

The affiliate marketing space has been plagued by two compounding problems for years: tracking gaps and operational overhead. Most SaaS companies cobble together Google Analytics for attribution, a standalone affiliate tool like Rewardful or PartnerStack for commission management, and a payment processor for payouts. Each handoff between systems introduces data loss, reconciliation delays, and manual work.

Dub collapses that stack into one system with a single source of truth for the entire partner lifecycle. For practitioners, this means:

For marketing teams: Every campaign link — whether posted on social, embedded in a newsletter, or distributed through an affiliate — feeds into the same attribution model. You stop arguing about whether a conversion belongs to the paid campaign or the influencer post because the server-side dub_id chain makes the attribution unambiguous.

For finance and operations: Framer, one of Dub’s largest customers, manages over 7,000 active partners and $900,000 in monthly payouts through the platform. Their Senior Financial Accountant, Carla Giordano, noted that Dub streamlined their payout process and saved approximately 40 hours of manual accounting work per month. That is a full work week, every month, recovered purely through automation.

For growth teams: The platform’s dual-sided incentive model — where the referring partner earns a commission and the referred customer receives a discount (for example, 30% off) — creates a self-reinforcing loop. The partner has a more compelling offer to share, the customer has a concrete reason to convert, and both sides win. Tella, which migrated to Dub from Rewardful, reported a 38% increase in partner-driven revenue within two months of adoption.

For developers: The SDK-first design means attribution can be wired into your product in hours rather than days. Deep linking support for iOS and React Native lets mobile teams close the loop between social media referrals and in-app purchase events — a gap that most affiliate platforms simply cannot bridge.

The competitive differentiation over legacy tools is the combination of server-side reliability and full-stack automation. You are not choosing between accurate attribution and operational scale; Dub delivers both from a single platform.


The Data

The table below compares Dub’s capabilities against common legacy affiliate management tools across the dimensions that matter most for SaaS growth programs:

Capability Dub Rewardful PartnerStack Impact.com
Tracking Method Server-side + first-party cookie Client-side JS pixel Client-side JS pixel Client-side JS pixel
Ad Blocker Resistance Yes No No Limited
Attribution Stages Click → Lead → Sale (3-stage) Click → Sale Click → Sale Click → Sale
Natural Language Analytics Yes (Ask AI) No No No
Max Partner Scale 100,000+ ~10,000 ~50,000 Enterprise tier
Automated Tax Compliance W-9 + 1099-NEC (US) Manual Manual Manual
Payout Methods Bank, PayPal, USDC Stablecoin Stripe payouts Stripe payouts Bank + PayPal
Mobile Deep Linking iOS + React Native No No Limited
Dual-Sided Incentives Yes (link-based discounts) No Limited Limited
Social Metrics Bounties Yes (CPM-based) No No No
AI Landing Page Generator Yes No No No
White-Label Embed Yes (headless) No Limited Yes (enterprise)
A/B Testing (Destination URLs) Yes No No Limited
SDK Languages TS, Python, Go, PHP, Ruby JS only JS + REST REST API
Request Latency Sub-150ms Not specified Not specified Not specified

Sources: Dub platform briefing, Dub documentation

The tracking method row is the most consequential. Every tool except Dub relies on client-side JavaScript to fire when a user’s browser loads your page. With ad blocker adoption rates high among technical audiences — exactly the users most SaaS companies want to reach — relying on client-side tracking means you are structurally undercounting conversions and over-attributing results to direct traffic.


Step-by-Step Tutorial: Setting Up Dub for Full-Cycle Attribution

This walkthrough covers the complete implementation path from account setup through live commission payments. The steps assume you are running a SaaS product with a Stripe-powered checkout and want to track the full journey from affiliate click to paying customer.

Prerequisites

  • A Dub account (sign up at dub.co)
  • Admin access to your product’s backend codebase
  • A Stripe account connected to your product
  • Node.js or Python installed for SDK integration
  • A custom domain for branded short links (optional but recommended)

Phase 1: Configure Your Workspace and Domain

Step 1 — Create your Dub workspace. After signing up, create a workspace for your product. Give it a name matching your brand. This workspace will contain all your links, analytics, and partner program.

Step 2 — Connect a custom domain. Navigate to Settings → Domains and add your branded short link domain (e.g., go.yourapp.com). Update your DNS with the CNAME record Dub provides. Branded short links improve trust and click-through rates compared to generic dub.sh links. This step typically takes 5-10 minutes for DNS propagation.

Step 3 — Connect Stripe. Go to Settings → Integrations → Stripe and authorize the connection. Dub will immediately begin listening to your Stripe webhook events — specifically checkout.session.completed, invoice.paid, and charge.refunded. This enables automatic sale and refund attribution without you writing any webhook handlers.


Phase 2: Implement Server-Side Click Tracking

This is the critical technical integration. Dub’s server-side tracking requires you to pass attribution data through your own backend rather than relying on the browser.

Step 4 — Install the SDK. For a Node.js/TypeScript backend:

npm install dub

For Python:

Infographic: How to Build a Scalable Affiliate Program with Dub Attribution
Infographic: How to Build a Scalable Affiliate Program with Dub Attribution
pip install dub

Step 5 — Initialize the Dub client. Create a dedicated module for your Dub client instance:

// lib/dub.ts
import { Dub } from "dub";

export const dub = new Dub({
  token: process.env.DUB_API_KEY,
});

Store your API key in your environment variables — never hardcode it.

Step 6 — Capture the dub_id on link click. When a user arrives via a Dub short link, the redirect appends a dub_id query parameter to the destination URL (e.g., https://yourapp.com/signup?dub_id=abc123). Your application needs to read this parameter and persist it for the session.

In a Next.js app, read it from the incoming request in your middleware or page handler:

// middleware.ts
import { NextRequest, NextResponse } from "next/server";

export function middleware(req: NextRequest) {
  const dubId = req.nextUrl.searchParams.get("dub_id");
  const res = NextResponse.next();

  if (dubId) {
    // Store as first-party cookie — 90-day expiry to match Dub default
    res.cookies.set("dub_id", dubId, {
      maxAge: 60 * 60 * 24 * 90,
      httpOnly: true,
      secure: process.env.NODE_ENV === "production",
      sameSite: "lax",
    });
  }
  return res;
}

This replicates what Dub’s own cookie logic does, ensuring the attribution data survives across sessions.


Phase 3: Track Lead and Sale Conversion Events

Step 7 — Fire the Lead event at signup. When a user completes your signup flow, call Dub’s track endpoint from your server-side signup handler — not from the client:

// app/api/auth/signup/route.ts
import { dub } from "@/lib/dub";
import { cookies } from "next/headers";

export async function POST(req: Request) {
  const { email, userId } = await createUser(req); // your user creation logic

  const dubId = cookies().get("dub_id")?.value;

  if (dubId) {
    await dub.track.lead({
      clickId: dubId,
      eventName: "Signup",
      customerId: userId,
      customerEmail: email,
    });
  }

  return Response.json({ success: true });
}

The customerId field is how Dub deduplicates — if the same user signs up twice, only one lead event is registered.

Step 8 — Let Stripe handle the Sale event. Because you connected Stripe in Phase 1, Dub automatically picks up checkout.session.completed events from your Stripe webhook. No additional code is needed for basic sale attribution. Dub matches the Stripe customer ID to the lead event from Step 7 and records the commission.

For products using custom checkout flows outside Stripe, you can fire a manual sale event:

await dub.track.sale({
  customerId: userId,
  amount: 4900, // in cents
  currency: "usd",
  eventName: "Subscription Started",
  invoiceId: `inv_${Date.now()}`,
});

Phase 4: Launch Your Affiliate Program

Step 9 — Enable Dub Partners. In your workspace dashboard, navigate to Partners → Enable. Define your commission structure:
Flat fee: e.g., $50 per new paid customer
Revenue share: e.g., 20% of monthly recurring revenue for 12 months
Tiered: e.g., 20% for first 10 referrals, 30% thereafter

Step 10 — Configure dual-sided incentives. Under your program settings, enable referral discounts. Set a discount percentage (e.g., 30%) that is automatically applied when a new customer arrives via an affiliate link. This creates a genuine value proposition for both the partner and the end customer, and according to the Dub platform briefing, it drives measurably higher click-through and conversion rates.

Step 11 — Generate the program landing page. Use Dub’s AI Landing Page Generator to create a branded affiliate program page in minutes. Navigate to Partners → Program Page → Generate with AI. Input your product description and tone preferences; Dub produces a ready-to-publish landing page you can customize. This dramatically reduces the time between deciding to launch a partner program and actually having a page to recruit from.

Step 12 — Invite your first partners. Use the Partners → Invite tool to send email invitations with unique affiliate links pre-generated. Partners land on an onboarding flow where they set up their payout method (bank transfer, PayPal, or USDC stablecoin).


Phase 5: Configure Payouts, Compliance, and Performance Tiers

Step 13 — Set up automated tax compliance. For US-based partners, navigate to Settings → Compliance. Enable automatic W-9 collection — Dub will prompt partners earning over $600 to submit their tax information before their first payout. Dub then issues 1099-NEC forms automatically at year-end. This is the feature that saved Framer 40 hours per month.

Step 14 — Configure Group Move Rules. Available on Advanced plans, Group Move Rules automate partner tier upgrades. For example: when a partner crosses $5,000 in referred revenue, automatically move them to your “VIP Group” with a higher commission rate. Set this up under Partners → Groups → Add Rule. You define the trigger (revenue threshold, number of referrals, or commission earned) and the target group. Partners receive an automated notification when they level up.

Step 15 — Run your first payout. On your chosen payout schedule (weekly, biweekly, or monthly), navigate to Partners → Payouts → Review and Pay. Dub presents a single invoice covering all eligible partner balances across all payout methods and geographies. Review, approve, and Dub handles the rest — currency conversion, international transfers, and payment receipts.

Expected Outcomes

After completing this implementation, you will have: server-side attribution tracking all clicks, leads, and sales without ad blocker interference; an active affiliate program with automated commission calculations; global payout infrastructure without manual reconciliation; and US tax compliance handled end-to-end. The typical onboarding timeline from account creation to first payout is one to two weeks, depending on DNS propagation, code review cycles, and partner onboarding speed.


Real-World Use Cases

Use Case 1: SaaS Company Migrating from Rewardful

Scenario: A 50-person SaaS company running a 200-partner affiliate program discovers that their Rewardful dashboard shows dramatically fewer conversions than their Stripe revenue, and the discrepancy is growing. After investigation, they identify that ad blockers on their developer-heavy user base are suppressing approximately 30% of tracking calls.

Implementation: They export existing partner data from Rewardful, import it into Dub, and implement the server-side SDK integration from Phase 2 of the tutorial above. They configure Stripe as the sale event source. Within the first billing cycle, attribution coverage increases significantly, and previously “unattributed direct” revenue is now correctly mapped to specific partners.

Expected Outcome: Partners who were previously earning less commission than deserved (because conversions went untracked) start earning correctly, improving partner satisfaction. The company gains an accurate picture of which partners drive the most revenue, allowing them to reallocate co-marketing budget toward the highest performers.

Use Case 2: Scale-Up Using Social Metrics Bounties

Scenario: A product-led growth company wants to incentivize influencers to create genuinely viral content, not just post a promo code and disappear. They need a mechanism to reward reach, not just conversions.

Implementation: They configure Dub’s Social Metrics Bounties feature, setting a reward of $1,000 for any partner whose content reaches 1 million views on X (Twitter) using a CPM-based payout model, as described in the Dub platform briefing. Partners who are building an audience — even if they have not yet driven direct sales — now have a reason to promote the product aggressively.

Expected Outcome: Increased top-of-funnel awareness from partners who would otherwise deprioritize the program. A measurable link between content performance metrics and program payouts. Partners who hit reach milestones are then primed for upsell into standard commission structures once they start driving conversions.

Use Case 3: Framer’s Enterprise-Scale Payout Operation

Scenario: Design platform Framer operates an affiliate program with 7,000+ active partners and $900,000 in monthly payouts. Manually reconciling payments, tracking commissions, and managing tax documentation at that scale was consuming 40+ hours of accounting time every month.

Implementation: Framer integrated Dub Partners as its full affiliate infrastructure. Payout processing moved from manual reconciliation to a single-invoice model. W-9 collection and 1099-NEC issuance became automatic. Their Senior Financial Accountant, Carla Giordano, specifically noted the ability to filter top-performing partners by month and quarter as a key operational improvement.

Expected Outcome: According to Framer’s published results, the company recovered approximately 40 hours of accounting work per month and gained real-time visibility into partner performance that simply did not exist with their previous toolstack. Koen Bok, CEO of Framer, described Dub as “the ultimate partner infrastructure for every startup.”

Use Case 4: Mobile SaaS Closing the Attribution Loop

Scenario: A SaaS company with both a web app and a mobile app runs influencer campaigns on Instagram and TikTok. Their current attribution setup tracks web signups correctly but cannot connect a mobile app install — triggered when a user taps a link in an Instagram Story — back to the originating affiliate post.

Implementation: They implement Dub’s Mobile SDK for iOS and React Native. Affiliate links shared by influencers are configured as deep links that, when tapped on a mobile device, open directly inside the app (or route through the App Store install flow while preserving the dub_id). The install and subsequent in-app purchase events are fired through the SDK just as the web signup event is.

Expected Outcome: Mobile-sourced revenue is now attributed to the influencers who drove it. Influencer compensation reflects actual mobile conversions, not just web signups. Marketing spend on mobile-first channels is properly evaluated against actual revenue contribution.

Use Case 5: White-Label Partner Dashboard Embedded in Product

Scenario: A B2B SaaS company wants to offer their customers a referral program — users can earn account credits by referring other companies. But they do not want users to leave the product to manage their referrals; they want the experience to feel native.

Implementation: They use Dub’s headless, white-label embed capability to insert a fully functional referral dashboard directly into their product’s account settings page. Partners never navigate to a separate partners.yourtool.com domain; they manage their links, track clicks, and request payouts from within the product they already use daily.

Expected Outcome: Higher partner activation rates because friction to join and use the program is eliminated. A branded, cohesive user experience that reinforces product value. Per the Dub platform briefing, enterprise customers use this exact feature to create experiences where users never have to leave the brand’s ecosystem.


Common Pitfalls

Pitfall 1: Relying on Client-Side dub_id Capture

Some teams read the dub_id from the URL using client-side JavaScript after page load. This defeats the purpose of server-side tracking. If an ad blocker prevents the JavaScript from running, or if the user navigates before scripts load, you lose the ID. Always read dub_id from the URL at the server level (middleware, edge function, or server route handler) and persist it as an httpOnly cookie immediately.

Pitfall 2: Skipping Tax Compliance Configuration Before Launch

US-based affiliate programs that skip W-9 collection discover the problem at year-end when they need to issue 1099-NEC forms for all partners earning over $600. Retroactively collecting tax information from hundreds or thousands of partners is painful. Enable Dub’s automated W-9 collection before your first payout, not after you have already paid out significant amounts.

Pitfall 3: Setting Commission Rates Without Margin Analysis

Configuring a 30% revenue share sounds compelling but can be unsustainable at scale if your gross margin is under 60%. Calculate your maximum viable commission rate before configuring your program. Use Dub’s revenue reporting to model what your actual partner-driven revenue looks like at different commission tiers before committing to a rate.

Pitfall 4: Not Configuring Fraud Detection Rules

Dub includes built-in fraud detection for paid traffic, self-referrals, duplicate accounts, and cross-program bans. These settings are not enabled by default in all configurations. Review your fraud detection settings under Partners → Settings → Fraud Protection before launching publicly. Self-referral fraud alone can represent 10-15% of commission spend in programs without controls.

Pitfall 5: Treating the Affiliate Program as a Set-and-Forget Channel

Attribution data without action is just storage. Schedule a monthly review of your top-10 performing partners, bottom-10 performing partners with high click volume (indicating a conversion problem, not a traffic problem), and any partners who recently crossed tier thresholds. Group Move Rules automate the tier upgrade, but human review of partner quality remains essential.


Expert Tips

Tip 1: Use A/B Testing to Find Your Highest-Converting Landing Page Before Scaling Partner Traffic
Before sending affiliate-driven traffic to a destination URL at scale, run Dub’s A/B testing feature to split traffic between your standard homepage and a dedicated partner landing page. Affiliate traffic has different intent than organic traffic — a page that converts well for paid ads may underperform for referral traffic. Find the winner first, then let your partners drive volume to it.

Tip 2: Implement Dual-Sided Incentives From Day One
The data from Dub’s customer outcomes — including Tella’s 38% revenue growth — consistently points to dual-sided incentives as a conversion multiplier. When a partner can say “here is my link and you get 30% off,” the offer is substantively better than “here is my link.” Build this into your program architecture from launch, not as a later optimization.

Tip 3: Use Group Move Rules to Create a Self-Funding VIP Program
Set your VIP tier threshold at a commission milestone that is self-evidently worthwhile for both sides — for example, partners who have already generated $10,000 in referred revenue. At that point, increasing their commission rate from 20% to 30% is funded by the incremental volume they are already delivering. The Group Move Rule does the upgrade automatically; you do not need to manually review and reassign.

Tip 4: Leverage USDC Stablecoin Payouts for International Partners
For partners in regions with volatile local currencies or high international transfer fees, offering USDC stablecoin payouts via Dub’s supported payout methods is a meaningful differentiator. Partners in Latin America, Southeast Asia, and Eastern Europe who would otherwise lose 3-5% to conversion fees and bank charges receive full-value payments. This can be a recruiting advantage in international partner outreach.

Tip 5: Query Ask AI to Surface Underperforming Campaigns, Not Just Top Performers
Most teams use analytics to celebrate what is working. Use Dub’s Ask AI to ask “which campaigns have the highest click volume but lowest conversion rates?” — this surfaces landing page problems, partner traffic quality issues, and attribution gaps faster than any manual dashboard review.


FAQ

Q: How does Dub handle attribution when a user clicks multiple affiliate links before purchasing?

Dub uses a last-touch attribution model by default — the most recent dub_id stored in the first-party cookie gets credit for the conversion. The 90-day cookie window means that if a user clicks an affiliate link, then returns via a different affiliate link a week later, the second partner receives the commission. For programs where multi-touch attribution is important, consult Dub’s advanced attribution configuration options in the documentation.

Q: Does Dub work if my product is not on Stripe?

Yes. While the Stripe integration provides the most seamless sale event tracking, Dub supports custom sale events via the SDK (as shown in the Phase 3 tutorial above). You can also integrate via Shopify for e-commerce, HubSpot for CRM-triggered events, or Zapier to bridge virtually any other platform. The core dub.track.sale() API call accepts any amount, currency, and invoice ID you pass to it.

Q: What is the difference between Dub’s standard plan and the Advanced plan?

Group Move Rules — the automated partner tier upgrade feature — requires an Advanced plan, per the Dub platform briefing. Enterprise features including white-label headless embeds and programs exceeding certain partner counts also require higher tiers. For programs under approximately 1,000 partners without tier automation needs, the standard plan covers the full attribution and payout stack.

Q: How does Dub’s tax compliance work for non-US partners?

The automated 1099-NEC issuance and W-9 collection applies specifically to US-based partners earning over $600. For non-US partners, Dub facilitates payouts via bank transfer, PayPal, and USDC stablecoin across hundreds of countries, but your tax compliance obligations for non-US partners are governed by your own jurisdiction and the treaties applicable to each partner’s country. Consult your tax advisor for specifics on international partner tax reporting requirements.

Q: Can we embed the partner dashboard inside our own product without redirecting to Dub’s domain?

Yes — this is exactly what the headless white-label embed capability provides. Enterprise customers use Dub’s embedded referral dashboard to place the partner experience directly inside their own product UI. Partners manage their links, track performance, and request payouts without ever seeing a Dub-branded interface or leaving the host product. This feature is documented in the Dub platform briefing as a key enterprise differentiation.


Bottom Line

Dub is the most technically complete affiliate and attribution platform available for SaaS companies right now — the combination of server-side tracking, automated global payouts, and full-stack compliance automation is not replicated by any single competitor. The $10 million in partner payouts processed within six months, Framer’s 40 hours of monthly accounting time recovered, and Tella’s 38% partner-driven revenue growth within two months are all documented outcomes, not marketing projections. For any company running more than 50 affiliates on client-side tracking today, the migration path is well-defined: implement the server-side SDK, connect Stripe, configure your commission rules, and let Dub handle the rest. The gap between what you think your affiliate program is producing and what it is actually producing — obscured by ad blockers and fragmented tooling — is almost certainly larger than you expect.


, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Like it? Share with your friends!

0

What's Your Reaction?

hate hate
0
hate
confused confused
0
confused
fail fail
0
fail
fun fun
0
fun
geeky geeky
0
geeky
love love
0
love
lol lol
0
lol
omg omg
0
omg
win win
0
win

0 Comments

Your email address will not be published. Required fields are marked *