Never rely on Chili Piper reading window.location.search at booking time. Persist gclid, gbraid, fbclid, and UTMs in first-party cookies on the landing page, populate hidden inputs on your Webflow/Marketo/HubSpot form before Chili Piper’s submit interceptor runs, and explicitly pass those mapped fields in your ChiliPiper.submit() payload so Salesforce Lead creation receives 100% of click attribution.
1. Inject Persisted Click IDs Before ChiliPiper.submit() Fires
function getCookie(name) {
const match = document.cookie.match(new RegExp("(^| )" + name + "=([^;]+)"));
return match ? decodeURIComponent(match[2]) : "";
}
// Run immediately on DOM ready AND right before form submission
function hydrateChiliPiperHiddenFields(formEl) {
const fieldMap = {
AR_GCLID__c: getCookie("ar_gclid"),
AR_GBRAID__c: getCookie("ar_gbraid"),
AR_FBCLID__c: getCookie("ar_fbclid"),
UTM_Source__c: getCookie("ar_utm_source"),
UTM_Campaign__c: getCookie("ar_utm_campaign")
};
Object.entries(fieldMap).forEach(([fieldName, val]) => {
const input = formEl.querySelector(`input[name="${fieldName}"]`);
if (input && val) input.value = val;
});
}
// Explicitly include lead attributes if triggering ChiliPiper.submit() programmatically
// ChiliPiper.submit("your-subdomain", "inbound-router", { map: true, lead: { ...hydratedFields } });
2. Prevent Overwriting First-Touch Attribution on Repeat Bookings
In Salesforce/Chili Piper field mapping, mark AR_GCLID__c and UTM_Campaign__c as “Do not overwrite if populated” for First-Touch fields (and store Latest-Touch in separate properties). Otherwise, a prospect who later clicks a direct calendar reschedule link wipes out the original $40 Google Search click.
Test your demo page live right now using our Live Funnel Leak Inspector.