POST
/
track
/
lead
require 'dub'

s = ::OpenApiSDK::Dub.new(
      security: ::OpenApiSDK::Shared::Security.new(
        token: "DUB_API_KEY",
      ),
    )

req = ::OpenApiSDK::Operations::TrackLeadRequestBody.new(
  click_id: "<id>",
  event_name: "Sign up",
  external_id: "<id>",
)

res = s.track.lead(req)

if ! res.object.nil?
  # handle response
end
{
  "click": {
    "id": "<string>"
  },
  "customer": {
    "name": "<string>",
    "email": "<string>",
    "avatar": "<string>",
    "externalId": "<string>"
  }
}

Conversions endpoints require a Business plan subscription or higher.

Authorizations

Authorization
string
header
required

Default authentication mechanism

Body

application/json
clickId
string
required

The unique ID of the click that the lead conversion event is attributed to. You can read this value from dub_id cookie.

Minimum length: 1
eventName
string
required

The name of the lead event to track. Can also be used as a unique identifier to associate a given lead event for a customer for a subsequent sale event (via the leadEventName prop in /track/sale).

Required string length: 1 - 255
Example:

"Sign up"

externalId
string
required

The unique ID of the customer in your system. Will be used to identify and attribute all future events to this customer.

Maximum length: 100
eventQuantity
number | null

The numerical value associated with this lead event (e.g., number of provisioned seats in a free trial). If defined as N, the lead event will be tracked N times.

customerName
string | null

The name of the customer. If not passed, a random name will be generated (e.g. “Big Red Caribou”).

Maximum length: 100
customerEmail
string | null

The email address of the customer.

Maximum length: 100
customerAvatar
string | null

The avatar URL of the customer.

mode
enum<string>
default:async

The mode to use for tracking the lead event. async will not block the request; wait will block the request until the lead event is fully recorded in Dub.

Available options:
async,
wait
metadata
object | null

Additional metadata to be stored with the lead event. Max 10,000 characters.

Response

200
application/json
A lead was tracked.
click
object
required
customer
object
required