To accurately track affiliate clicks, you must include the Trackdesk tracking script on every page of your website, including all landing pages. This script serves as the foundation of your tracking setup, allowing the system to identify and register visitors referred by your affiliates.
⚠️ Important:
This script is required for most integration types using Direct Linking. Without it, Trackdesk cannot track clicks generated by affiliates.
Place it as high as possible in the
<head>, ideally right after the opening<head>tag, so the click is recorded before the visitor can leave the page.This Click script is not required if you plan to use Redirect Tracking or Coupon Tracking exclusively.
Before you start
Tenant ID: You will need your unique Trackdesk Tenant ID. See where to find your Tenant ID.
Website access: Make sure you have administrative access to your website's source code or a script management tool.
Step-by-step instructions
Step 1: Copy the tracking script
Copy the code block below. This script is designed to load asynchronously so it does not impact your website's loading speed.
<!-- 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", "click");
</script>
<!-- Trackdesk tracker end -->
Step 2: Configure your Tenant ID
In the code you just copied, replace both occurrences of TENANT_ID with your Tenant ID.
For example, if your Tenant ID is my-store-123, the script URL becomes //my-store-123.trackdesk.com/main.js and the last line becomes trackdesk("my-store-123", "click");.
Step 3: Install the script on your website
Log in to your website's CMS or open your site's HTML files.
Navigate to the header configuration or locate the
<head>tag in your global template.Paste the modified script immediately after the opening
<head>tag.Save and Publish your changes.
Testing and troubleshooting
How to verify the integration
Generate a test link: Create an affiliate link for yourself in Trackdesk.
Perform a test click: Open a private or incognito browser window and paste your affiliate link.
Check results: In Trackdesk, go to Reports → Clicks. Your click should appear in the report within a few moments.
Troubleshooting common issues
Clicks are not registering: Make sure your Tenant ID is exactly right in both places in the script, and that it stays in double quotes in the
trackdesk(...)call.
Next steps
After successfully installing the click script, you might want to connect your payment gateway to track conversions. Common integrations include:
See the list of all available integrations.
