When using Standard Pardot Forms on a Pardot page and trying to integrate Chili Piper, we take advantage of the form's default completion action URL and will append field values as query string parameters.
Note this does not work with the iFrame implementation code, and the implementations are not interchangeable. If you update the code below, make sure you update it in all areas.
This article will cover how to successfully implement Chili Piper with Pardot forms on native Pardot pages:
- Add custom code to your Pardot form settings
- Optional
- Custom field names using CSS class names
Look & Feel → Below Form Code Editor
Before we begin, have your domain and router name at the ready. Your domain and router names are found in your inbound router under the Embed code section -
In Pardot, navigate to your form, under "Look and Feel" open the "Below Form" Source code, and add the script from the link below, being sure to follow directions to replace [[domain]] with your domain and [[router_name]] with the correct router name.
Please get the latest version of this implementation from here.
Paste the code in as shown here:
Hit Confirm & Save
Parent Webpage Code
Add the Following Code to the Parent Webpage in which the Pardot Embed HTML code resides.
<script src="https://js.chilipiper.com/marketing.js" type="text/javascript"></script>
<script>
var leadValues = {};
var uri = decodeURIComponent(
window.location.href.split("?").length > 1
? window.location.href.split("?")[1].replace(/\+/g, " ")
: ""
);
var urlParams = uri.split("&");
var valid = false;for (var i = 0; i < urlParams.length; i++) {
var pair = urlParams[i].split("=");
var key = pair[0];
var value = pair[1] || "";if (key.toLowerCase().indexOf("email") !== -1 && value.indexOf("@") !== -1) {
valid = true;
}leadValues[key] = value;
}if (valid && Object.keys(leadValues).length > 0) {
</script>
ChiliPiper.submit(leadValues["CPTenantDomain"], leadValues["CPTenantRouter"], {
map: true,
lead: leadValues
});
}
Custom field names using CSS class names
When looking for field names to use, we check the CSS class names first, then placeholders and labels. Sometimes your form labels need to be complex and include some simple instructions, making the label hard to read and use for mapping in Chili Piper. With this implementation, you can specify field names using CSS Class names in Pardot. This will make mapping easier and more predictable.
Here is how to specify a CSS class name on a Pardot field:
- Open your form in Pardot and click the Edit Button - Fields - Small Edit icon next to the field.
- From here, click on Advanced and enter a CSS Class name starting with "CP_".
For example, "CP_FirstName".
- That's it! Now save and repeat for any other fields you want to specify a name for.