Create Conversions via POST Request
David Rolenc avatar
Written by David Rolenc
Updated over a week ago

Conversions can be created via POST request. In order to do so, please follow the instructions below.


When a visitor enters the landing page, you will need to have our click tracking script present on the page in order for us to generate the CID of a click. You will then need to take this generated CID and save it for the user. The CID is saved to a cookie named trakdesk_cid. With this CID, you are able to create a conversion when it occurs.
​

Format of the POST Request

  1. URL to send the request to: https://YOUR_TENANT_ID.trackdesk.com/tracking/conversion/v1
    Instead of YOUR_TENANT_ID use your actual tenant ID.

  2. And the body of the request should be:

{
"cid": "OUR_CID",
"conversionTypeCode": "SELECTED_CONVERSION_TYPE"
}

Make sure to replace "OUR_CID" with the CID you saved previously.

Make sure to replace "SELECTED_CONVERSION_TYPE" with the conversion type for which you want to create the conversion (will depend on how you set the offer).

Revenue Share

To use revenue share, you also need to provide the amount of revenue when creating the conversion.

Here is the body content for this case:

{
"cid": "OUR_CID",
"conversionTypeCode": "SELECTED_CONVERSION_TYPE",
"amount": {
"value": "CONVERSION_AMOUNT"
}
}

Make sure to replace "CONVERSION_AMOUNT" with the amount you want to prorate to the system.

Make sure to replace "SELECTED_CONVERSION_TYPE" and "OUR_CID" as described in the above variants.

The amount is used to calculate the final payouts of the affiliate depending on what % values you have for the offer.

Conversions with an External CID

In order to create a conversion with an External CID you will first need to set the External CID. This is done either via script Set external CID or via a POST request to set the External CID.

By Script, put the set external CID script to the page where a visitor has our tracking cookie saved, and you are able to provide us with a unique identification (External CID), for example, ID from your database or email of the visitor.

<!-- Trackdesk tracker begin -->
<script async src="//cdn.trackdesk.com/tracking.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("YOUR_TENANT_ID", "externalCid", {
"externalCid": "YOUR_EXT_CID",
"revenueOriginId": "YOUR_REVENUE_ORIGIN_ID"
});
</script>
<!-- Trackdesk tracker end -->

Make sure to replace YOUR_TENANT_ID with your actual tenant ID, it can be found on the settings main page.

Make sure to replace YOUR_EXT_CID with the External ID you want to save.

Make sure to replace YOUR_REVENUE_ORIGIN_ID with your Revenue origin ID, it can be found on the settings main page.

Or via Post request

  1. to URL https://YOUR_TENANT_ID.trackdesk.com/tracking/external-cid/v1
    Instead of YOUR_TENANT_ID use your actual tenant ID.

  2. With request body

{
"externalCid": "YOUR_EXT_CID",
"revenueOriginId": "YOUR_REVENUE_ORIGIN_ID",
"cid": "OUR_CID"
}

Make sure to replace YOUR_EXT_CID with the External ID you want to save.

Make sure to replace YOUR_REVENUE_ORIGIN_ID with your Revenue origin ID, it can be found on the settings main page.

Make sure to replace "OUR_CID" with the CID you saved previously.

You then can continue to create the conversion with External CID

If you wish to create a conversion with an External CID with a POST request, then body of the request will need to be followed for sent to the same URL as in the examples above for conversions with CID.

{
"externalCid": "YOUR_EXTERNAL_CID",
"revenueOriginId": "YOUR_REVENUE_ORIGIN_ID"
"conversionTypeCode": "SELECTED_CONVERSION_TYPE"
}

Make sure to replace "YOUR_EXTERNAL_CID" with the external ID for the conversion it is created for.

Make sure to replace "YOUR_REVENUE_ORIGIN_ID" with your Revenue origin ID, this ID can be found in your Trackdesk platform in offer tracking in setup for recurring commissions.

Make sure to replace "SELECTED_CONVERSION_TYPE" as described in the above variants.

And likewise for variant of revenue share with External CID

{
"externalCid": "YOUR_EXTERNAL_CID",
"revenueOriginId": "YOUR_REVENUE_ORIGIN_ID"
"conversionTypeCode": "SELECTED_CONVERSION_TYPE",
"amount": {
"value": "CONVERSION_AMOUNT"
}
}

Make sure to replace variables as described in the above variants.

Did this answer your question?