Core concepts
Attribution
Send every signal you have. SmoothProfit tries them in order and the first that resolves wins — extra fields never hurt, and a missing one just falls through.
| 1 | Click idclickId | Identifies the exact visit. Survives a changed referral code and can't be guessed. |
| 2 | Referral codereferralCode | From ?ref=. Reliable, but says nothing about which visit converted. |
| 3 | Coupon codecouponCode | A 1-to-1 code. Works with no click at all — the customer heard it on a podcast. |
| 4 | Lifetime emailcustomerEmail | A returning customer with no other signal, credited to whoever first referred them. |
Lifetime email is opt-in
It defaults to off. Enabling it means a customer's future orders keep crediting the affiliate who first referred them — potentially forever — which is a real commercial commitment, not a default anyone should back into. Set lifetime_email_window_days to expire it after a period; 0 means genuinely lifetime.
Matching is on a SHA-256 hash of the address, never plaintext, so turning this on does not turn your conversions table into a customer email list.
The attribution cookie
The tracker stores both identifiers in a first-party sp_ref cookie as JSON:
{ "referralCode": "a8f2k1x9", "clickId": "4b91..." }Read it server-side at checkout rather than threading it through your UI — attribution then works regardless of which flow started the order, including flows you haven't built yet. Or call window.smoothprofit.getAttribution() client-side instead of parsing the cookie by hand.
Self-referral blocking
An affiliate buying through their own link is blocked when the customer email matches theirs. The conversion is still recorded, as rejected with a fraud flag, so the attempt is auditable rather than vanishing. Name matching is available but opt-in — two different Jane Smiths is a real scenario; an identical email is not.