1. Identify your domain and your inbound router name
The script you must add to this page will include two values you need to identify from your inbound router.
Your Domain
You can find this in your inbound router.
Your Router Name
This is your inbound router name:
2. Replace values in the script and add them to your Ninja Forms page
Replace Domain and RouterName values you found above in the script below and copy them to your Ninja Forms page before the body end tag
<script src="https://js.chilipiper.com/marketing.js" type="text/javascript"></script>
<script type="text/javascript">
const cpTenantDomain = "Domain"; // Chili Piper subdomain
const cpRouterName = "RouterName"; // Chili Piper router API name
//
// No changes needed from this point
//
jQuery(document).ready(function ($) {
if (typeof Marionette !== "undefined") {
const mySubmitController = Marionette.Object.extend({
initialize: function () {
this.listenTo(Backbone.Radio.channel("forms"), "submit:response", this.actionSubmit);
},
actionSubmit: function (response) {
if (!response?.data?.fields_by_key) return;
const lead = {};
for (const [fieldName, fieldData] of Object.entries(response.data.fields_by_key)) {
const name = fieldData.custom_name_attribute || fieldName;
const value = fieldData.value || "";
if (name) lead[name] = value;
}
console.log(lead);
ChiliPiper.submit(cpTenantDomain, cpRouterName, {
map: true,
lead: lead,
});
},
});
new mySubmitController();
}
});
</script>