Lead tracking
Record signups, demo bookings, or any qualifying event short of a sale.
Use lead tracking when you want partners to be credited for top-of-funnel events — newsletter signups, free-trial starts, demo bookings, etc. Lead events trigger a partner.lead.created webhook and (if a group has a lead reward) a commission row.
POST /api/track/lead
Call this from your backend when the lead-qualifying event happens:
await fetch("https://partli.app/api/track/lead", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.PARTLI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
externalId: "signup_abc123", // your unique signup id (used for dedupe)
customerEmail: "[email protected]", // optional but useful
customerName: "Alex", // optional
clickId: cookies.get("pref_cid"), // attribution cookie (from click tracking)
eventName: "signup", // optional; default is "lead"
metadata: { plan: "free" }, // optional; arbitrary JSON
}),
});Behavior
- If
clickIdresolves to a partner → the lead event is attributed - If no
clickIdor it expired → no attribution, no commission - If the partner's group has a
leadreward configured → a commission row is created - Without a group-level lead reward → only the event is recorded, no commission (no program-level fallback for leads)
Idempotent
Pass a stable
externalId per event. Re-posting the same externalId is a no-op — safe to retry on transient failures.Common patterns
Newsletter signup — fire from your form-submit handler with the email as customerEmail.
Free trial — fire when the trial starts. Pair with sale tracking when they convert to paid.
Demo booked — fire from your scheduling tool's webhook (Calendly, Cal.com, etc.).