Coupon Code Tracking: How to Attribute Revenue When Affiliates Use Codes, Not Links
34% of affiliate conversions happen via coupon codes, not tracked links. How to attribute revenue from codes — and what you lose when you can't.
Muzahid Maruf, Founder

Coupon Code Tracking: How to Attribute Revenue When Affiliates Use Codes, Not Links
34% of affiliate conversions happen via coupon codes, not tracked links. How to attribute revenue from codes — and what you lose when you can't.
34% of affiliate conversions never touch a tracked link. According to PartnerStack's affiliate benchmark data, that fraction of buyers reaches the checkout page through a route that bypasses every click-tracking mechanism you have — they saw a coupon code in a YouTube description, a newsletter footer, or a podcast read, typed it at checkout, and converted without a single tracked click. Coupon code tracking is the practice of mapping a discount or promotion code back to the affiliate, campaign, or channel that distributed it, so that Stripe charges carrying that code can be attributed to revenue even when no tracked link preceded them. Without it, you are paying commissions blind and measuring affiliate revenue with a 34% gap.
Key takeaway
A third of your affiliate revenue may be arriving with no link click in sight — only a coupon code at checkout. If your attribution model requires a click, that revenue goes unattributed to the partner who earned it, you overpay or underpay commission, and your channel comparisons are structurally wrong.
Why This Matters for Your Revenue
The financial damage from code-blind attribution runs in two directions at once. First, affiliates who drive conversions primarily through codes — podcasters, newsletter authors, YouTubers — show zero or near-zero conversion in your click-based dashboard even when they are driving real revenue. The rational response is to reduce or cancel their commission; the actual effect is to defund your best top-of-funnel partners. Second, because those conversions still appear somewhere, they fall into "Direct" or "Organic Search" — channels that then look disproportionately strong and attract more budget for no good reason.
The dollar cost of a 34% blind spot
The economic stakes are not trivial. If 34% of affiliate revenue is unattributed, and affiliate drives even 20% of your total MRR, you are misclassifying roughly 7% of all company revenue every month. At $50,000 MRR that is $3,500 per month sitting in the wrong bucket — enough to make or break a channel budget decision. Closing this gap with code-level attribution is one of the fastest ways to get an honest read on partner ROI without changing a single creative or commission structure.
How coupon code tracking works technically
When a buyer enters a promotion code at checkout, your payment processor records it against the transaction. In Stripe, a successful charge using a promotion code includes the promotion_code field on the PaymentIntent or Subscription object. Your job is to read that field from the Stripe event and look it up in a table that maps promotion codes to affiliates, campaigns, or channels.
Reading the promotion code from Stripe
The mapping itself is simple: each affiliate gets one or more unique promotion codes. When a Stripe charge arrives, you retrieve the promotion_code ID, resolve it to the human-readable code string, and match it against your mapping table. The resulting attribution record ties the charge to the partner, the discount amount, the gross and net revenue, and the date — everything you need to calculate commission and measure channel performance.
Resolving conflicts when a code and a link compete
The complication arises when a buyer uses both a tracked link and a code from a different affiliate. In that case you have two attribution signals competing for the same conversion. You need a clear rule before you start: does the code override the click (last-touch by code), does the click win (last-touch by click), or do you split? Most SaaS programmes use code-wins because the code was explicitly typed — it is a deliberate act of redemption, not a passive cookie.
Conversion rates by channel type — code vs link
Coupon codes perform differently from tracked links depending on the distribution channel. Channels with high-intent, loyal audiences tend to drive higher code-redemption rates; channels where audiences browse passively tend to favour the click path.
| Channel type | Primary attribution method | Click-to-paid rate | Code-to-paid rate | Code share of total conversions |
|---|---|---|---|---|
| Podcast sponsorship | Code | 0.4% | 3.1% | 71% |
| Newsletter sponsorship | Both | 2.8% | 2.2% | 44% |
| YouTube review / tutorial | Both | 1.6% | 2.7% | 56% |
| Blog / SEO review post | Link | 2.1% | 0.7% | 24% |
| Social media (paid partner post) | Link | 1.3% | 0.5% | 27% |
| Community / Discord mention | Code | 0.9% | 3.4% | 68% |
Based on TrackRev platform data, 2026. Click-to-paid and code-to-paid rates are medians across SaaS workspaces; figures vary by price point and offer depth.
Three approaches to coupon code attribution
There is no single architecture that fits every affiliate programme. The right approach depends on your commission structure, the number of affiliates, and how much overlap you expect between link clicks and code redemptions.
Unique code per affiliate — 1:1 mapping
The cleanest model: every affiliate receives exactly one promotion code that no one else uses. When that code appears on a Stripe charge, the affiliate is credited automatically — no ambiguity, no overlap, no lookup table more complex than a flat key-value map. This works perfectly for programmes with up to a few hundred affiliates where code management is not burdensome.
The trade-off is operational: you must generate a new code for every new affiliate, disable it promptly when a partnership ends, and decide what to do if an affiliate promotes someone else's code by mistake (rare but real). For programmes at scale, code proliferation can become a Stripe admin problem — Stripe's Promotion Codes API makes bulk creation scriptable, which removes most of the friction.
Because the mapping is 1:1, this approach also gives you clean commission accounting: gross revenue from codes with affiliate ID X equals affiliate X's commission base. No weighting, no attribution split, no disputed conversions. For most SaaS affiliate programmes under 200 partners, this is the correct starting point. See also how this integrates with the broader affiliate program link tracking setup.
Code + link combination — belt and braces
For affiliates who post both a tracked link and a code — common in blog reviews — you can capture both signals and apply a priority rule. The tracked link fires a first-party click event with the affiliate's ID; the code arrives later at checkout. If both point to the same affiliate, you have a confirmation signal. If they differ, your priority rule resolves the conflict.
The main advantage of this approach is redundancy: if the tracked link click is lost (cookie blocked, cross-device, long attribution window), the code still closes the loop. The disadvantage is that you need your affiliate platform and your Stripe attribution layer to share a common affiliate ID namespace — otherwise reconciling the two signals becomes a join across two unrelated identifier schemes. TrackRev's affiliate tracking uses the same affiliate ID for both links and codes, making the join trivial.
Post-purchase survey for high-ticket or code-heavy funnels
When your product is priced above $200/month, many buyers will complete their own research journey across multiple channels before committing. In that scenario, no single link or code tells the whole attribution story — the podcast code got them aware, the blog post convinced them, the trial email closed them. A one-question post-purchase survey ("Where did you hear about us?") adds the human layer that code and click tracking cannot recover.
This is not a replacement for technical attribution — it is a supplement for the portion of high-ticket conversions where self-reported attribution is more accurate than any inferred signal. Aggregate the survey responses quarterly and use them to adjust channel weightings in your attribution model. Pair the survey data with the code and link data for the closest thing to a ground-truth view of your affiliate funnel.
Stripe promotion-code integration
Reading the promotion code from a Stripe charge takes a single API call after the payment_intent.succeeded webhook fires.
Extracting the code from the webhook payload
The snippet below fetches the PaymentIntent with its invoice expanded, then pulls the promotion code string from the first discount.
// After receiving the payment_intent.succeeded webhook event:
const stripe = require("stripe")(process.env.STRIPE_SECRET_KEY);
async function getPromoCode(paymentIntentId) {
const intent = await stripe.paymentIntents.retrieve(paymentIntentId, {
expand: ["invoice.discounts.promotion_code"],
});
const invoice = intent.invoice;
if (!invoice || !invoice.discounts || invoice.discounts.length === 0) {
return null; // No promotion code used
}
const discount = invoice.discounts[0];
const promoCode = discount.promotion_code; // Expanded object
return promoCode?.code ?? null; // e.g. "PARTNER_ALICE_20"
}
// Map the code string to your affiliate record:
async function attributeCharge(paymentIntentId, affiliateMap) {
const code = await getPromoCode(paymentIntentId);
if (!code) return { attributed: false };
const affiliate = affiliateMap[code.toUpperCase()];
if (!affiliate) return { attributed: false, code };
return { attributed: true, code, affiliateId: affiliate.id };
}Attribution accuracy by method
Each approach has a different accuracy ceiling depending on how cleanly it can be implemented. "Accuracy" here means the proportion of real affiliate-driven conversions that are correctly attributed to the right partner.
| Method | Attribution accuracy | Commission dispute rate | Implementation complexity | Best suited for |
|---|---|---|---|---|
| Unique code per affiliate (1:1) | 96% | Under 2% | Low | Programmes ≤200 affiliates |
| Code + tracked link (combined) | 98% | Under 1% | Medium | Mixed link/code affiliates |
| Link only (no code fallback) | 66% | 11% | Low | Blog/SEO-only programmes |
| Post-purchase survey (supplement) | N/A — qualitative | N/A | Low | High-ticket, multi-touch |
| Shared promo code (no 1:1 mapping) | 22% | High | None | Not recommended |
Accuracy estimates based on PartnerStack affiliate programme benchmarks and internal implementation patterns; dispute rates are approximate.
Where code tracking breaks and how to prevent it
Coupon code attribution has failure modes that link tracking does not. Understanding them before you build prevents the most expensive mistakes.
Code leakage and sharing
The most damaging failure mode is when an affiliate's code escapes its intended audience and becomes a public discount.
- Code sharing across buyers — a buyer posts the affiliate's code publicly (Reddit, coupon sites) and it is redeemed by people the affiliate never reached. Add a per-customer redemption limit in Stripe (max 1 per customer) so the code retains its affiliate-specific signal rather than becoming a generic discount.
- Affiliate switches to a competitor's code — if you share a generic brand code (e.g.,
SAVE20) with multiple affiliates instead of unique codes, you cannot tell who drove the conversion. Never use shared codes for commission attribution.
Operational failures — expiry and typos
These failures lose conversions outright rather than mis-attributing them.
- Code expiry mismatches — an affiliate promotes a code that has already expired, the buyer fails at checkout, and you lose the conversion and the affiliate's goodwill. Set expiry dates in Stripe and notify affiliates automatically at least 14 days before a code expires.
- Typos at checkout — a buyer hears a code on a podcast and misspells it. Stripe returns an error, the sale is lost, and you never see the conversion. Consider offering a small set of phonetically distinct codes that are hard to mishear (avoid similar characters like O/0, I/l/1).
Cross-device code redemption — a hidden advantage
Not all code-tracking edge cases are problems. Cross-device code redemption — a buyer sees the code on mobile and redeems it on desktop — is actually an advantage. Unlike link tracking, code attribution is device-agnostic — the code travels in the buyer's memory, not in a cookie. Code attribution naturally solves the problem that plagues link-based cross-device attribution.
Code-attribution gap by programme size
Programmes using shared or generic codes (e.g. a single PARTNER20 for all affiliates) attribute only 22% of code-driven conversions correctly, versus 96% for programmes with unique 1:1 codes. The upgrade from shared to unique codes is a one-time migration that pays back in accurate commission accounting within the first payment cycle.
Track affiliate codes and links together with TrackRev
TrackRev reads Stripe promotion codes from every incoming charge and matches them against your affiliate mapping in real time. Each affiliate's dashboard shows click revenue, code revenue, and combined revenue in a single view — no manual reconciliation, no spreadsheet joins. You can create tracked links and map promotion codes under the same affiliate ID, so the belt-and-braces approach requires no extra plumbing. Commission calculations run automatically: net revenue per affiliate, per code, per campaign, with the analytics drill-down going all the way to individual charges. Read more about the broader setup in affiliate program link tracking and compare approaches in affiliate attribution vs channel attribution.
When NOT to use TrackRev for coupon code tracking
If your affiliate programme is purely click-based — blog reviewers and comparison-site listings who always use a tracked link and never promote a code — the Stripe promotion-code layer adds complexity without adding value. Likewise, if you are running a consumer e-commerce promotion (not a SaaS affiliate programme) where codes are broadly advertised rather than partner-specific, TrackRev's 1:1 mapping model is not the right fit. TrackRev is designed for SaaS affiliate programmes where each partner has a distinct audience and a distinct code; it is not a general-purpose coupon-management system.
Frequently asked questions
- What percentage of affiliate conversions happen through coupon codes rather than tracked links?
- According to PartnerStack benchmark data, approximately 34% of affiliate conversions happen via coupon code rather than a tracked link click. The share is significantly higher for podcast and community-based affiliates, where code-to-paid rates often exceed 3% while click-to-paid rates sit below 1%.
- How do I read a promotion code from a Stripe charge?
- After a payment_intent.succeeded webhook fires, retrieve the PaymentIntent with the invoice and its discounts expanded. Stripe returns a discount object containing the promotion_code field, which resolves to the human-readable code string. You can then look up that string in your affiliate-to-code mapping table to attribute the charge.
- What happens if a buyer uses both a tracked affiliate link and a different affiliate's coupon code?
- You have two competing attribution signals. Most SaaS programmes apply a code-wins rule, treating the explicitly typed code as a deliberate act of redemption that overrides the passive link click. You should define this rule before you launch so commission disputes can be resolved consistently.
- Can coupon code tracking solve cross-device attribution problems?
- Yes — this is one of coupon codes' underappreciated strengths. A code travels in the buyer's memory, not in a browser cookie, so it works identically whether the buyer sees the code on mobile and redeems it on desktop hours later. Unlike click-based link tracking, code attribution is naturally device-agnostic.