Skip to main content
POST
/
track
/
lead
Python
from dub import Dub


with Dub(
    token="DUB_API_KEY",
) as d_client:

    res = d_client.track.lead(request={
        "click_id": "<id>",
        "event_name": "Sign up",
        "customer_external_id": "<id>",
    })

    # Handle response
    print(res)
{
  "click": {
    "id": "<string>"
  },
  "link": {
    "id": "<string>",
    "domain": "<string>",
    "key": "<string>",
    "shortLink": "<string>",
    "url": "<string>",
    "partnerId": "<string>",
    "programId": "<string>",
    "tenantId": "<string>",
    "externalId": "<string>"
  },
  "customer": {
    "name": "<string>",
    "email": "<string>",
    "avatar": "<string>",
    "externalId": "<string>"
  }
}
Conversions endpoints require a Business plan subscription or higher.

Deduplication behavior

Lead events are automatically deduplicated to prevent duplicate tracking:
  • Events are deduplicated based on the combination of customerExternalId (the user ID of the referred customer within your database) and eventName
  • If you send multiple lead events with the same customer ID and event name, only the first event will be tracked
  • Subsequent duplicate events will return null and won’t be tracked

Authorizations

Authorization
string
header
required

Body

application/json
clickId
string
required
eventName
string
required
Required string length: 1 - 255
Example:
customerExternalId
string
required
Required string length: 1 - 100
customerName
string | null
Maximum length: 100
customerEmail
string<email> | null
Maximum length: 100
customerAvatar
string | null
mode
enum<string>
default:async
Available options:
async,
wait,
deferred
eventQuantity
number | null
metadata
object | null

Response

click
object
required
customer
object
required