This guide explains how to integrate ClickFunnels with Trackdesk to support email attribution for leads. This setup is particularly useful if you want to connect email forms to external tools like Stripe for attribution.
Before starting, ensure you have already created a funnel within your ClickFunnels account.
Step-by-Step Instructions
Step 1: Create a funnel in ClickFunnels
Navigate to your ClickFunnels dashboard and ensure the funnel you wish to track is active and ready for configuration.
Step 2: Install the Click Tracking Code
To track clicks, you must include the following tracking script on every page of your funnel.
In ClickFunnels, navigate to your funnel's Settings.
Copy the following Click Tracking code:
<!-- 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 -->
⚠️ Make sure to replaceYOUR_TENANT_IDwith your actual Trackdesk Tenant ID.
Locate the Head Code section in your ClickFunnels settings and paste the code there.
Click Update Funnel to save your changes.
Step 3: Install the Lead and Email Script
Next, you need a specific script to capture the user's email address and send it to Trackdesk as a lead. This script should be placed on the page where users enter their email address.
Navigate back to your funnel's Settings.
Copy the following Lead and Email script code:
<!-- Trackdesk process email and send lead for internal flow - 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");
document.addEventListener("DOMContentLoaded", function() {
let emailInput = document.querySelector("input[name='email']");
if (emailInput) {
emailInput.addEventListener("blur", function() { // Fires when user leaves the field
let emailValue = emailInput.value.trim();
// Email validation: must contain @, a domain, and a dot (e.g., [email protected])
let emailPattern = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
if (emailPattern.test(emailValue)) {
// 🔥 FIRE TRACKDESK CODE 1 (Conversion Tracking)
trackdesk("YOUR_TENANT_ID", "conversion", {
"conversionType": "lead"
});
// 🔥 FIRE TRACKDESK CODE 2 (External CID Tracking)
trackdesk("YOUR_TENANT_ID", "externalCid", {
"externalCid": emailValue, // Using email as externalCid
"revenueOriginId": "YOUR_REVENUE_ORIGIN_ID"
});
}
});
}
});
⚠️ Make sure to replaceYOUR_TENANT_IDwith your Tenant ID andYOUR_REVENUE_ORIGIN_IDwith your Revenue Origin ID.
Locate the Footer Code section and paste the script there.
Click Update Funnel to finish the setup.
Once completed, your setup is ready to support email attribution, whether you are using Stripe customer email attribution or other email based methods.




