Appearance
Customer & Cleanup
All method calls must be inside the async IIFE shown in the Getting Started guide for sub-pages.
Identify Customer
No URL params — call after login or signup to link the customer to the affiliate session.
javascript
await sdk.identify({
email: "customer@example.com",
userId: "user_12345", // Optional
name: "John Doe", // Optional
});Destroy SDK
No URL params — call after trackThankYouPageViewed() on the order confirmation page to clean up the SDK instance.
If called after **trackThankYouPageViewed()**:
- Affiliate and discount cookies (
aff_ref,aff_discount) are cleared - No stale discount banner will appear on subsequent pages
- Session and event queue are reset
- Attribution is already recorded by
trackOrder()— nothing is lost
If NOT called after **trackThankYouPageViewed()**:
aff_refandaff_discountcookies remain active for up to 30 days- Discount banner will keep appearing on product pages even though the code may no longer be valid
- User sees a discount they cannot use — misleading UX
javascript
await sdk.trackThankYouPageViewed({
orderId: "ORD-12345",
customer: { email: "customer@example.com" },
});
await sdk.destroy();
// Clears: session, cookies (aff_ref, aff_discount), event queue, listeners