Discount-code attribution (no-click sales)
Set a code prefix in your brand settings. We mint a unique discount code per influencer (e.g. JANE-AbCd1234). Buyers who paste the code at checkout — even without clicking the tracking URL — attribute to that creator automatically.
Why this exists
The audit numbers are blunt: 30–70% of Instagram-creator-driven sales never carry a tracking cookie. Reasons:
- IG strips link query params from in-app browsers
- Buyers see the brand on a Story, screenshot, then shop a week later from desktop
- Buyers ask for “Jane’s code please” in DMs and paste it at checkout
- iOS Safari ITP truncates the cookie window to 7 days for most cross-site flows
Without discount-code attribution, all those sales record zero commission. The creator promoted, the brand sold, but the creator got nothing — and they’ll stop promoting next month.
Discount-code attribution closes this gap.
How it works end-to-end
- You set a code prefix in Brands → Edit → Affiliate → Basics tab. Example:
NIKE. - Influencer applies to your affiliate campaign. We mint:
- Their tracking token:
AbCd1234 - Their tracking URL:
https://kpfc.link/AbCd1234 - Their discount code:
NIKE-ABCD1234(uppercase, same 8 chars as the token)
- Their tracking token:
- Creator shares the code in their caption / story / video / DMs
- Customer types
NIKE-ABCD1234at your checkout - Your checkout sends us the code via postback / pixel / Shopify webhook
- We attribute — same commission, same wallet credit, same holdback rules as a clicked-link sale
Where to capture the code
Shopify (auto)
Shopify’s order webhook includes a discount_codes array:
{
"id": 7301421,
"discount_codes": [
{ "code": "NIKE-ABCD1234", "amount": "10.00", "type": "percentage" }
],
...
}
Our Shopify webhook handler reads it automatically. No code changes on your side — just configure the Shopify webhook per Postback HMAC integration and discount-code attribution turns on by itself.
WooCommerce
WooCommerce: $order->get_coupon_codes() returns the array. Pull the first one and pass it to the postback as discount_code:
$codes = $order->get_coupon_codes();
$payload['discount_code'] = $codes[0] ?? null;
$payload['token'] = $_COOKIE['kf_aff'] ?? null;
// send both — we try token first, fallback to code
sendPostback($payload);
Custom checkout
Whatever code field your cart uses, pass it as discount_code in the postback / pixel JSON body:
KFAffiliate.trackPurchase({
order_id: 'ABC123',
gross_amount: 99.99,
currency: 'USD',
discount_code: cartState.appliedCouponCode, // ← here
});
The JS pixel auto-reads orderData.discount_code if you pass it through.
Manual cart attribute (Shopify themes without webhook access)
If your Shopify plan blocks webhook config but you have theme access, add the code to a cart attribute that our pixel auto-reads:
<input type="hidden" name="attributes[kf_aff_code]" value="{{ cart.discount_codes | first | downcase }}">
Then our pixel picks it up from cart.attributes.
Do you need to give the customer an actual discount?
Not technically required — the code can be attribution-only with 0% off, and it still works. But:
- Realistic adoption — creators don’t share “use code NIKE-ABCD” if it doesn’t save the buyer anything. Set ~10% off on the codes so creators have something to promise.
- Brand-side configuration — you need to ALSO create the discount in your store’s promo system (Shopify Discounts, WooCommerce Coupons). Our system attributes; YOUR system applies the discount. They’re two separate setups using the same code string.
Recommended pattern:
| Code | Discount | Attribution |
|---|---|---|
NIKE-ABCD1234 (auto-minted) | 10% off (you configure in Shopify Discounts) | Jane Doe (auto-attributed by our system) |
What about codes the creator chose, not the auto-mint?
You can override the auto-mint. Inside the brand’s Affiliate → Tracking tab, contact your support rep to set a custom code on a specific creator’s link (no self-service for this yet — Sprint 3 follow-up). Until then, stick with the auto-minted format — it’s collision-safe.
What we DON’T attribute
- Generic site-wide codes like
SUMMER10shared on your homepage. Those are not in ourcampaign_influencer_linkstable, so we look them up, don’t find them, log a “no_token_or_code” event, and skip. - Codes from non-affiliate campaigns. Only codes whose campaign has
affiliate_enabled=trueparticipate. - Expired or inactive codes. If you suspend a creator’s link or set
active_toin the past, their code stops attributing.
Verifying it works
Three checks:
- Buy with the code in test mode. Use a friendly creator’s code, complete a $1 test order without clicking their link first. Confirm the conversion lands in your admin Affiliate Ops → Conversions tab.
- Audit the postback log for
source = shopify,event_type = sale,reason = ok. The conversion row should showattribution_method: discount_code. - Confirm wallet credit — the creator’s wallet should reflect the commission. They see it on their
/influencer/affiliatedashboard.
If the conversion lands but doesn’t credit the wallet, the code’s campaign_influencer_link is missing or soft-deleted. Re-mint by asking the creator to re-apply.
Migration from cookie-only
If you’ve been running affiliate for months without discount codes and want to turn them on:
- Setting a
code_prefixonly affects newly-minted links (going forward). Existing links keep their no-code state until the creator re-applies. - To backfill existing links with codes, contact support — there’s a one-shot DB migration we can run for your brand.
The numbers
A typical e-com brand running Instagram creator affiliate, after turning code attribution on:
- Total attributed revenue: +35% (industry median for IG-heavy programs)
- Creator retention: +28% (creators promote what pays them)
- Cookie-only revenue: −12% (some cookie sales shift to code sales — they were the same buyer, you weren’t double-counting)
- Net new revenue: ~+23% from previously-uncaptured sales
These are floor numbers — Instagram-first brands see closer to +50–70%.
Frequently asked questions
Does discount-code attribution replace the tracking link?
No, both work in parallel. We try the kf_aff cookie first; if it's empty, we look up the code on the order. Most sales use cookies (link clicks); the code rescues the 30-70% of IG-creator sales where the cookie was lost.
Does the code give the customer an actual discount?
Only if you also configure the same code as a discount in your store. Many brands do BOTH — the code gives the customer 10% off AND attributes the sale to the creator who shared it.
What if a customer uses two creators' codes?
We attribute to whichever code we see first in the discount_codes array Shopify sends. Most stores enforce one-code-per-cart at checkout anyway.
Can two creators have the same code?
No. Each campaign_influencer_link mints a unique 8-char token; the code is BRAND_PREFIX-<TOKEN>, so collisions are 1 in 218 trillion.