Skip to main content

Create Conversions via POST Request

Create conversions with a POST request using a Click ID or your own External CID.

You can create conversions in Trackdesk manually by sending a POST request. This is useful for custom integrations where standard tracking scripts might not capture every event.


​

Prerequisites: capturing the CID

To create a conversion, you first need a Click ID (CID).

  • When a visitor lands on your page, the Trackdesk click tracking script must be present to generate this ID.

  • The script automatically saves the CID in a browser cookie named trakdesk_cid.

  • You must retrieve and store this CID (e.g., in your database or session) to use it later in your POST request.

Conversions via Click ID

Use these formats when you are tracking conversions using the standard Trackdesk Click ID.

Fixed amount

Use this for offers with a predefined, fixed payout.

Endpoint URL:

https://TENANT_ID.trackdesk.com/tracking/conversion/v1

Request body:

{
"cid": "CLICK_ID",
"conversionTypeCode": "CONVERSION_TYPE"
}

Replace these values:

  • TENANT_ID: your Tenant ID

  • CLICK_ID: the Click ID you saved from the visitor's cookie

  • CONVERSION_TYPE: the code of the Conversion Type (e.g., sale or signup)

Revenue share (dynamic amount)

If your offer pays a percentage of the sale, you must include the conversion amount so the system can calculate the correct payout.

Endpoint URL:

https://TENANT_ID.trackdesk.com/tracking/conversion/v1

Request body:

{
"cid": "CLICK_ID",
"conversionTypeCode": "CONVERSION_TYPE",
"amount": {
"value": "AMOUNT"
}
}

Replace these values:

  • TENANT_ID: your Tenant ID

  • CLICK_ID: the Click ID you previously saved

  • CONVERSION_TYPE: the code of the Conversion Type (e.g., sale or signup)

  • AMOUNT: the conversion amount as a string. Use "100" for whole numbers or "100.50" for decimals

Conversions via External CID

If you prefer to identify users by your own internal IDs (like a database ID or email address), you can use an External CID. This is a two-step process: first link your External CID to the Trackdesk CID, then create the conversion.

Link the External CID

Before you can track a conversion using your own ID, you must first link the Trackdesk CID to your External CID. You can do this via script or POST request.

Via script

Place this code right before the closing </body> tag of the page where the visitor has their tracking cookie saved, so any customer details on the page are already loaded when it runs:

<!-- Trackdesk tracker begin -->
<script async src="//TENANT_ID.trackdesk.com/main.js"></script>
<script>
(function(t,d,k){(t[k]=t[k]||[]).push(d);t[d]=t[d]||t[k].f||function(){(t[d].q=t[d].q||[]).push(arguments)}})(window,"trackdesk","TrackdeskObject");

trackdesk("TENANT_ID", "externalCid", {
"externalCid": "EXTERNAL_CID",
"revenueOriginId": "REVENUE_ORIGIN_ID"
});
</script>
<!-- Trackdesk tracker end -->

Replace these values:

  • TENANT_ID: your Tenant ID (both occurrences)

  • EXTERNAL_CID: the External CID you want to save

  • REVENUE_ORIGIN_ID: your Revenue Origin ID

Via POST request

Endpoint URL:

https://TENANT_ID.trackdesk.com/tracking/external-cid/v1

Request body:

{
"externalCid": "EXTERNAL_CID",
"revenueOriginId": "REVENUE_ORIGIN_ID",
"cid": "CLICK_ID"
}

Replace these values:

  • TENANT_ID: your Tenant ID

  • EXTERNAL_CID: the External CID you want to save

  • REVENUE_ORIGIN_ID: your Revenue Origin ID

  • CLICK_ID: the Click ID you previously saved

Create the conversion

Once linked, send your conversion via a POST request using the externalCid instead of the standard cid.

Fixed amount

Endpoint URL:

https://TENANT_ID.trackdesk.com/tracking/conversion/v1

Request body:

{
"externalCid": "EXTERNAL_CID",
"revenueOriginId": "REVENUE_ORIGIN_ID",
"conversionTypeCode": "CONVERSION_TYPE"
}

Replace these values:

  • TENANT_ID: your Tenant ID

  • EXTERNAL_CID: the External CID you linked in the previous step

  • REVENUE_ORIGIN_ID: your Revenue Origin ID

  • CONVERSION_TYPE: the code of the Conversion Type (e.g., sale or signup)

Revenue share (dynamic amount)

Endpoint URL:

https://TENANT_ID.trackdesk.com/tracking/conversion/v1

Request body:

{
"externalCid": "EXTERNAL_CID",
"revenueOriginId": "REVENUE_ORIGIN_ID",
"conversionTypeCode": "CONVERSION_TYPE",
"amount": {
"value": "AMOUNT"
}
}

Replace these values:

  • TENANT_ID: your Tenant ID

  • EXTERNAL_CID: the External CID you linked in the previous step

  • REVENUE_ORIGIN_ID: your Revenue Origin ID

  • CONVERSION_TYPE: the code of the Conversion Type (e.g., sale or signup)

  • AMOUNT: the conversion amount as a string. Use "100" for whole numbers or "100.50" for decimals

Did this answer your question?