Skip to main content

Install Tracking Script (Click script) On Your Website

Written by Zuzana Toulcová
Updated yesterday

To accurately track affiliate clicks, you must include the Trackdesk tracking script on every page of your website where you want to monitor traffic, 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. Without it, Trackdesk cannot track affiliate generated clicks.

  • For the best results and to ensure the script loads before a user leaves the page, position the code as high as possible within the HEAD tag of your website.



1. Before You Start

  • Tenant ID: You will need your unique Trackdesk Tenant ID. You can learn more about what it is and where to find it here.

  • Website Access: Ensure you have administrative access to your website's source code or a script management tool.


2. 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="//cdn.staging.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", "click");
</script>
<!-- Trackdesk tracker end -->


Step 2: Configure Your Tenant ID

In the code snippet you just copied, locate the placeholder YOUR_TENANT_ID. Replace it with your actual Trackdesk Tenant ID.

Example: If your ID is my-store-123, the line should look like: trackdesk("my-store-123", "click");


Step 3: Install the Script on Your Website

  1. Log in to your website's CMS or open your site's HTML files.

  2. Navigate to the header configuration or locate the <head> tag in your global template.

  3. Paste the modified script immediately after the opening <head> tag.

  4. Save and Publish your changes.


3. Testing & Troubleshooting

How to Verify the Integration

  1. Generate a Test Link: Create an affiliate link for yourself within the Trackdesk.

  2. Perform a Test Click: Open a private/incognito browser window and paste your affiliate link.

  3. Check Results: Go to your Trackdesk dashboard and navigate to the Reports > Clicks section. Your click should appear in the report within a few moments.

Troubleshooting Common Issues

  • Clicks are not registering: Ensure the Tenant ID is exactly correct and enclosed in double quotes.




4. Next Steps

After successfully installing the click script, you might want to connect your payment gateway to track conversions. Common integrations include:

Did this answer your question?