sdk-js
sdk-js copied to clipboard
Implement new `LeadGenerated` event on SDK
Event properties
- leadId (optional) — string — The user's unique identifier provided by the application, such as a UUID or a username. The value must be between 1 and 100 characters long.
- currency (optional) — string — The currency in which the lead value is accounted, such as "USD" or "EUR". We recommend using the 3-letter currency codes defined by the ISO 4217 standard. For currencies having no official recognition in the standard, consider using ISO-like codes adopted locally or commercially, such as "XBT" for BitCoin.
- value (optional) — number — The total value associated with the lead. The value must be non-negative.
- lead (optional) — The lead information.
- firstName (optional) — string — The first name of the user. For example, "John". The value must be between 1 and 50 characters long.
- lastName (optional) — string — The last name of the user. For example, "Doe". The value must be between 1 and 50 characters long.
- email (optional) — string — The email address of the user. For example, "[email protected]". The value must be between 1 and 254 characters long.
- phone (optional) — string — The phone number of the user. For example, "+1 555 555 5555". The value must be between 1 and 30 characters long.
- company (optional) — string — The company the user works for. The value must be between 1 and 200 characters long.
- companyUrl (optional) — string — The URL of the company the user works for. The value must be a well-formed URL.
- jobTitle (optional) — string — The job title of the user. The value must be between 1 and 50 characters long.
- custom (optional) — object — A map of custom attributes associated with the user. The following restrictions apply to custom attributes:
- Profiles support up to 10 custom attributes
- Attribute names must be strings up to 20 characters, starting with a letter or underscore, followed by letters, digits, or underscores
- Attributes can be primitives (strings, numbers, booleans, null) or collections (lists, maps)
- Strings can be up to 100 characters long
- Lists can contain up to 30 elements, including primitives, lists of primitives, or maps of primitives
- Maps can contain up to 30 elements, including primitives, lists of primitives, or maps of primitives
- Map keys must be strings up to 50 characters long
Derived events
Make the SDK track a UserProfileChanged event to update the user profile (as we do for UserSignedUp, for example).
Payload examples
Basic
{
}
Full
{
"leadId": "AXJH-1234",
"currency": "USD",
"value": "50.00",
"lead": {
"firstName": "John",
"lastName": "Doe",
"email": "[[email protected]](mailto:[email protected])"
"phone": "+1 555 555 5555",
"company": "Acme",
"companyUrl": "https://acme.com",
"jobTitle": "CEO",
"custom": {
"industry": "Financial services",
"employees": "51-200"
"features": ["AI", "ChatBot", "Workflows"]
}
}
}