Skip to content

Latest commit

 

History

History
124 lines (87 loc) · 5.43 KB

README.md

File metadata and controls

124 lines (87 loc) · 5.43 KB

Track

(track)

Overview

Available Operations

  • lead - Track a lead
  • sale - Track a sale

lead

Track a lead for a short link.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Dub;
use Dub\Models\Operations;

$security = 'DUB_API_KEY';

$sdk = Dub\Dub::builder()->setSecurity($security)->build();

$request = new Operations\TrackLeadRequestBody(
    clickId: '<id>',
    eventName: 'Sign up',
);

$response = $sdk->track->lead(
    request: $request
);

if ($response->object !== null) {
    // handle response
}

Parameters

Parameter Type Required Description
$request Operations\TrackLeadRequestBody ✔️ The request object to use for the request.

Response

?Operations\TrackLeadResponse

Errors

Error Type 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\SDKException 4XX, 5XX */*

sale

Track a sale for a short link.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Dub;
use Dub\Models\Operations;

$security = 'DUB_API_KEY';

$sdk = Dub\Dub::builder()->setSecurity($security)->build();

$request = new Operations\TrackSaleRequestBody(
    amount: 996500,
    paymentProcessor: Operations\PaymentProcessor::Paddle,
    eventName: 'Purchase',
);

$response = $sdk->track->sale(
    request: $request
);

if ($response->object !== null) {
    // handle response
}

Parameters

Parameter Type Required Description
$request Operations\TrackSaleRequestBody ✔️ The request object to use for the request.

Response

?Operations\TrackSaleResponse

Errors

Error Type 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\SDKException 4XX, 5XX */*