Skip to content

Latest commit

 

History

History
197 lines (154 loc) · 11 KB

README.md

File metadata and controls

197 lines (154 loc) · 11 KB

Track

(Track)

Overview

Available Operations

  • Lead - Track a lead
  • Sale - Track a sale
  • Customer - Track a customer ⚠️ Deprecated

Lead

Track a lead for a short link.

Example Usage

package main

import(
	dubgo "github.com/dubinc/dub-go"
	"github.com/dubinc/dub-go/models/operations"
	"context"
	"log"
)

func main() {
    s := dubgo.New(
        dubgo.WithSecurity("DUB_API_KEY"),
    )

    ctx := context.Background()
    res, err := s.Track.Lead(ctx, &operations.TrackLeadRequestBody{
        ClickID: "<value>",
        EventName: "Sign up",
        CustomerID: dubgo.String("<value>"),
    })
    if err != nil {
        log.Fatal(err)
    }
    if res != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request operations.TrackLeadRequestBody ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.TrackLeadResponseBody, error

Errors

Error Type Status Code Content Type
sdkerrors.BadRequest 400 application/json
sdkerrors.Unauthorized 401 application/json
sdkerrors.Forbidden 403 application/json
sdkerrors.NotFound 404 application/json
sdkerrors.Conflict 409 application/json
sdkerrors.InviteExpired 410 application/json
sdkerrors.UnprocessableEntity 422 application/json
sdkerrors.RateLimitExceeded 429 application/json
sdkerrors.InternalServerError 500 application/json
sdkerrors.SDKError 4XX, 5XX */*

Sale

Track a sale for a short link.

Example Usage

package main

import(
	dubgo "github.com/dubinc/dub-go"
	"github.com/dubinc/dub-go/models/operations"
	"context"
	"log"
)

func main() {
    s := dubgo.New(
        dubgo.WithSecurity("DUB_API_KEY"),
    )

    ctx := context.Background()
    res, err := s.Track.Sale(ctx, &operations.TrackSaleRequestBody{
        CustomerID: dubgo.String("<value>"),
        Amount: 996500,
        PaymentProcessor: operations.PaymentProcessorShopify,
        EventName: dubgo.String("Purchase"),
    })
    if err != nil {
        log.Fatal(err)
    }
    if res != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request operations.TrackSaleRequestBody ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.TrackSaleResponseBody, error

Errors

Error Type Status Code Content Type
sdkerrors.BadRequest 400 application/json
sdkerrors.Unauthorized 401 application/json
sdkerrors.Forbidden 403 application/json
sdkerrors.NotFound 404 application/json
sdkerrors.Conflict 409 application/json
sdkerrors.InviteExpired 410 application/json
sdkerrors.UnprocessableEntity 422 application/json
sdkerrors.RateLimitExceeded 429 application/json
sdkerrors.InternalServerError 500 application/json
sdkerrors.SDKError 4XX, 5XX */*

Customer

Track a customer for an authenticated workspace.

⚠️ DEPRECATED: This will be removed in a future release, please migrate away from it as soon as possible.

Example Usage

package main

import(
	dubgo "github.com/dubinc/dub-go"
	"context"
	"log"
)

func main() {
    s := dubgo.New(
        dubgo.WithSecurity("DUB_API_KEY"),
    )

    ctx := context.Background()
    res, err := s.Track.Customer(ctx, nil)
    if err != nil {
        log.Fatal(err)
    }
    if res != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request operations.TrackCustomerRequestBody ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.TrackCustomerResponseBody, error

Errors

Error Type Status Code Content Type
sdkerrors.BadRequest 400 application/json
sdkerrors.Unauthorized 401 application/json
sdkerrors.Forbidden 403 application/json
sdkerrors.NotFound 404 application/json
sdkerrors.Conflict 409 application/json
sdkerrors.InviteExpired 410 application/json
sdkerrors.UnprocessableEntity 422 application/json
sdkerrors.RateLimitExceeded 429 application/json
sdkerrors.InternalServerError 500 application/json
sdkerrors.SDKError 4XX, 5XX */*