This guide explains how to integrate Trackdesk with your GoHighLevel (GHL) website when using Stripe as your payment provider. This method uses the customer's email address to link lead forms to successful Stripe payments for accurate attribution.
โ ๏ธ Important: This method can be used when the lead form is part of the checkout process in GHL.
1. Step-by-Step Instructions
Step 1: Install and Configure the Trackdesk Stripe App
First, you need to connect Trackdesk to your Stripe account.
Go to the Stripe Marketplace and install the Trackdesk app.
Open the app settings within your Stripe dashboard.
โEnter your Tenant ID and Personal Token in the required fields.
Click Save changes.
Step 2: Set Up Click Tracking
To track visitor clicks, you must include the tracking code on every page of your GHL website, including all landing pages associated with your offers. For the best results, place this code in the <head> section of your site.
<!-- 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', 'click');
</script>
<!-- Trackdesk tracker end -->
Replace YOUR_TENANT_ID with your Tenant ID.
Step 3: Enable Lead Form Tracking
This step ensures that when a user fills out a lead form, their email address is captured and saved as an External CID. The Trackdesk Stripe app will then use this email to attribute the eventual payment to the correct affiliate.
Copy and paste the following script into the Footer section of the page containing your lead form:
<!-- Help script save External CID on form confirm start -->
<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");
(function() {
function attachFormBtnHandler() {
document.querySelectorAll('.form-btn').forEach(function(formBtn) {
if (!formBtn.dataset.listenerAttached) {
formBtn.addEventListener('click', function() {
setTimeout(function() {
try {
var emailInputs = Array.from(document.querySelectorAll("input[name=email]"));
emailInputs.some(function(input) {
if (/\S+@\S+\.\S+/.test(input.value)) {
if (typeof trackdesk !== "undefined") {
trackdesk("YOUR_TENANT_ID", "externalCid", {
externalCid: input.value,
revenueOriginId: "YOUR_REVENUE_ORIGIN_ID",
});
return true; // Exit the loop early if a valid email is found
} else {
console.error("Not available.");
}
}
return false;
});
} catch (e) {
console.error(e);
}
}, 1000);
});
formBtn.dataset.listenerAttached = true; // Mark the button as having a listener attached
}
});
}
// Use a MutationObserver to watch for changes in the DOM
var observer = new MutationObserver(function(mutationsList) {
mutationsList.some(function(mutation) {
if (mutation.type === 'childList') {
attachFormBtnHandler(); // Re-run the handler attachment logic when new nodes are added
return true; // Exit the loop early after processing a mutation
}
return false;
});
});
// Start observing the document body for changes
observer.observe(document.body, { childList: true, subtree: true });
// Initial run to attach handlers to any existing form buttons
attachFormBtnHandler();
})();
</script>
<!-- Help script save External CID on form confirm end -->
Replace
YOUR_TENANT_IDwith your Tenant ID.Replace
YOUR_REVENUE_ORIGIN_IDwith your Revenue Origin ID.
2. Testing Your Integration
Before officially launching your affiliate program, it's important to verify that clicks and conversions are being tracked correctly.
You can perform a test by following the steps in our guide: "Testing an Offer". This ensures that every part of the integration is communicating perfectly with Trackdesk.

