The click script supports an optional callback function, which allows you to access the generated CID (Click ID) on the client side.
How it works
When a user visits an affiliate tracking link and lands on your page:
The click script processes URL parameters
A request is sent to Trackdesk
A CID is generated and returned
The CID is stored in a cookie called
trakdesk_cid, note that abbreviation is on purpose
Using a callback
You can pass a callback function as the fourth parameter in the trackdesk function.
Example:
<!-- 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("yourtenantid", "click", {}, (data) => {
console.log(data.cid);
});
</script>
<!-- Trackdesk tracker end -->
Replace yourtenantid with your actual Tenant ID.
What data is available?
The callback provides the following values:
data.cid → The generated Click ID
data.expiredAt → Expiration timestamp of the tracking cookie
The CID can then be used later in your flow to create conversions or pass it to other systems.
When should you use this?
Use the callback when you need to:
Store the CID in your own system
Pass the CID to another tool (e.g. forms, CRM, analytics)
Debug tracking implementation
Alternative: Use the Script Builder
You can also generate tracking scripts directly in the platform:
Navigate to Offer detail → Integrations → Tracking code
Click “Build script”
The builder allows you to configure and generate scripts with different options without manual coding.
Summary
The click script supports an optional callback
The callback returns the CID and expiration timestamp
CID can be reused for conversion tracking or integrations
The tracking cookie is stored as
trakdesk_cid

