(track)
Track a lead for a short link.
import { Dub } from "dub";
const dub = new Dub({
token: "DUB_API_KEY",
});
async function run() {
const result = await dub.track.lead({
clickId: "<value>",
eventName: "Sign up",
customerId: "<value>",
});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.TrackLeadRequestBody | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.TrackLeadResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
errors.BadRequest | 400 | application/json |
errors.Unauthorized | 401 | application/json |
errors.Forbidden | 403 | application/json |
errors.NotFound | 404 | application/json |
errors.Conflict | 409 | application/json |
errors.InviteExpired | 410 | application/json |
errors.UnprocessableEntity | 422 | application/json |
errors.RateLimitExceeded | 429 | application/json |
errors.InternalServerError | 500 | application/json |
errors.SDKError | 4xx-5xx | / |
Track a sale for a short link.
import { Dub } from "dub";
const dub = new Dub({
token: "DUB_API_KEY",
});
async function run() {
const result = await dub.track.sale({
customerId: "<value>",
amount: 996500,
paymentProcessor: "shopify",
});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.TrackSaleRequestBody | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.TrackSaleResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
errors.BadRequest | 400 | application/json |
errors.Unauthorized | 401 | application/json |
errors.Forbidden | 403 | application/json |
errors.NotFound | 404 | application/json |
errors.Conflict | 409 | application/json |
errors.InviteExpired | 410 | application/json |
errors.UnprocessableEntity | 422 | application/json |
errors.RateLimitExceeded | 429 | application/json |
errors.InternalServerError | 500 | application/json |
errors.SDKError | 4xx-5xx | / |
Track a customer for an authenticated workspace.
import { Dub } from "dub";
const dub = new Dub({
token: "DUB_API_KEY",
});
async function run() {
const result = await dub.track.customer({
customerId: "<value>",
});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.TrackCustomerRequestBody | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.TrackCustomerResponseBody>
Error Object | Status Code | Content Type |
---|---|---|
errors.BadRequest | 400 | application/json |
errors.Unauthorized | 401 | application/json |
errors.Forbidden | 403 | application/json |
errors.NotFound | 404 | application/json |
errors.Conflict | 409 | application/json |
errors.InviteExpired | 410 | application/json |
errors.UnprocessableEntity | 422 | application/json |
errors.RateLimitExceeded | 429 | application/json |
errors.InternalServerError | 500 | application/json |
errors.SDKError | 4xx-5xx | / |