Affiliate attribution
Capture partner, referral, and campaign references with URL parameters, SDK metadata, and checkout events.
Use pf_ref as the canonical public reference parameter for new Plandalf links.
Capture a reference from the URL
https://example.com/sales-page?pf_ref=partner_123
When the SDK loads, it can attach that reference to the visitor identity and later checkout calls.
Pass explicit metadata
For affiliate platforms that expose a click ID or referral code in JavaScript, pass metadata at checkout time.
await plandalf.present("pro-plan", {
metadata: {
affiliate_click_id: window.tolt_referral,
source: "partner"
}
});
Lazy metadata
If an affiliate script loads after the Plandalf script, configure metadata as a function so it is evaluated when the checkout session is created.
plandalf("configure", {
metadata: {
tolt_referral: () => window.tolt_referral
}
});
Verify after purchase
Listen for purchase events and confirm the resulting invoice or webhook contains the expected attribution context.
const handle = plandalf.present("pro-plan");
for await (const event of handle.events) {
if (event.type === "purchase") {
console.log(event.invoice);
}
}
Related docs
Builder context
Keep building from here.
Use the related Plandalf pages to connect this doc to offers, checkout, timers, integrations, automation, and implementation recipes.