Tracking Referrals
How affiliate referrals are tracked and attributed.
Updated
On this page
Overview
Referrals are tracked automatically when a customer uses an affiliate's discount code at checkout. The affiliate receives credit for the sale.
Referral Link Validation
import dash from "@/lib/dash"
const result = await dash.referrals.validate({
secret: "ref_abc123", // referral secret from URL
subtotal: "99.99",
})
// result = {
// valid: true,
// referrer_first_name: "John",
// code: "JOHNS-REF",
// is_percentage: true,
// rate: "15",
// discount_amount: "15.00",
// meetsMinimum: true
// }