Integration using JS
Martin Demiger avatar
Written by Martin Demiger
Updated over a week ago

You can take our basic JavaScript code if we don't give you a ready-to-use guide in our Integration section. This is the most universal integration option with your website, as our script can be adjusted to your specific needs.

How does the integration look in general?

  • You place a piece of code on your website that will allow Trackdesk to track affiliate clicks

  • You place a piece of code on your thank-you page on your website (the last page people see after they buy or sign up). Only then the affiliate commissions can be properly calculated.

Get the Click Script

First, grab the click tracking script from your affiliate Trackdesk program. You'll need this to see when users click on affiliate links. You can obtain the tracking script in 2 ways:

Offer detail โ†’ Tracking methods section

Open any offer and go to the Tracking methods section. Choose JavaScript, and you will get a step-by-step manual to guide you through the process.

Offer detail - Tracking methods JS.png

See the Integrations section in the main menu

  • Integrations - JS.png

Insert the script into your Website

This script needs to be placed on ALL pages of your website. If you use subdomains (e.g., app.yourdomain.com), make sure the script is placed on these subdomains as well.

Head to the landing page where you plan to put the affiliate links and monitor clicks. Pick a suitable place to add the click-tracking script to the page's code. The best is to place the code within the <head> part of the HTML.

click script detail.png

Get the Conversion Script

At this stage, you should be able to track all the clicks coming to your website. Now we need to also place a script that tracks successful conversions on your thank you page.

You can obtain the script in the same way as you get the click script. Just skip the first step and follow the instructions on setting your desired Conversion type.

conversion type detail.png

Insert the Conversion Script into your Website

Open the thank you page where you want to track conversions. Typically, this is the page users land on after completing a desired action (e.g., purchasing or signing up). The conversions are tracked through Conversion types. Your platform comes by default with three conversion types:

  • Lead

  • Sale

  • Free Trial

You can track as many Conversions as you need. However, please remember that a script must be placed for each Conversion type individually.

Once the script is in place, remember to save your changes to the HTML code.


By following these steps and integrating the click-tracking script on your landing page and the conversion-tracking script on your thank you page, you'll ensure accurate tracking of clicks and conversions within your affiliate program. Always test the integration thoroughly to confirm that everything is working as intended.

Did this answer your question?