captureLead()
Captures a lead programmatically and associates them with the current affiliate attribution.
Signature
await window.FairShareSDK.captureLead(leadData);
Parameters
| Parameter | Type | Description |
|---|---|---|
leadData | object | Lead information |
LeadData Object:
| Property | Type | Required | Description |
|---|---|---|---|
message | string | No | Lead's message |
contact | object | Yes | Contact information |
Contact Object (union type - use one):
Option 1: Email contact (email required, phone optional)
| Property | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Contact name |
email | string | Yes | Email address |
phone | string | No | Phone number |
Option 2: Phone contact (phone required, email optional)
| Property | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Contact name |
email | string | No | Email address |
phone | string | Yes | Phone number |
Returns
Promise<ApiResponse> — Response with status.
Examples
With Email
await window.FairShareSDK.captureLead({ message: "I'm interested in learning more", contact: { name: "John Doe", email: "john@example.com", phone: "+1 (800) 555-1234" // Optional } });
With Phone
await window.FairShareSDK.captureLead({ message: "Please call me back", contact: { name: "Jane Smith", phone: "+1 (800) 555-1234", email: "jane@example.com" // Optional } });
Related
- Lead Capture — Lead capture section
- Attribution — Attribution settings