Last updated

captureLead()

Captures a lead programmatically and associates them with the current affiliate attribution.

Signature

await window.FairShareSDK.captureLead(leadData);

Parameters

ParameterTypeDescription
leadDataobjectLead information

LeadData Object:

PropertyTypeRequiredDescription
messagestringNoLead's message
contactobjectYesContact information

Contact Object (union type - use one):

Option 1: Email contact (email required, phone optional)

PropertyTypeRequiredDescription
namestringYesContact name
emailstringYesEmail address
phonestringNoPhone number

Option 2: Phone contact (phone required, email optional)

PropertyTypeRequiredDescription
namestringYesContact name
emailstringNoEmail address
phonestringYesPhone 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
  }
});