Track lead events
Endpoint
POST /api/track/lead
Track a lead conversion event for a short link. This endpoint creates a lead event and upserts a customer record.
Endpoint text
POST /api/track/leadAuthentication
Requires authentication with an API key that has the conversionsWrite scope.
Request Body
Accepts a single object (not an array). All fields are required unless marked optional.
| Parameter | Type | Required | Description |
|---|---|---|---|
clickId (body) | string | Yes | Click ID to attribute the lead. Use an empty string ("") for deferred tracking. |
eventName (body) | string | Yes | Lead event name (1-255 characters). |
customerExternalId (body) | string | Yes | Customer external ID (1-100 characters). Used to upsert the customer. |
customerName (body) | string | Yes | Customer name (max 100 characters). |
customerEmail (body) | string (email) | No | Customer email. Optional. Can be null to clear. |
customerAvatar (body) | string (URL) | No | Customer avatar URL. Optional. Can be null to clear. |
metadata (body) | object | No | Optional metadata object stored with the lead event. |
Deferred Tracking
Send clickId as an empty string ("") to attribute the lead to the customer's most recent lead click. This fails if the customer has no previous leads.
Capture clickId in the browser
If you don't already have a clickId, use the Browser attribution script to persist `hoko_id` and pass it to this endpoint. See [Browser attribution script](/docs/track/analytics-js).