Using the ChiliPiper.submit
or ChiliPiper.scheduling
function in your Chili Piper Javascript Snippet provides callback methods. There are a lot of possibilities you can do with the callback methods based on the status of the popup and booking.
<script src="https://js.chilipiper.com/marketing.js" type="text/javascript"></script>
<script>ChiliPiper.scheduling("account-name", "example-router", {
callbackMethod: someFunction()
})
</script>
Below are some of the callback methods that can be used in the Chili Piper snippet:
onSuccess: function
This will call a function after a successful booking. A time-specific redirect can be defined within the Router UI under "Router Redirect," this option is rarely used for redirect purposes and is used primarily with more custom form integrations.
<script src="https://js.chilipiper.com/marketing.js" type="text/javascript"></script>
<script>ChiliPiper.scheduling("account-name", "example-router", {
map: true,
onSuccess: someFunction()
})
</script>
A sample use case of the above could be for tracking purposes:
<script src=“https://js.chilipiper.com/marketing.js” type=“text/javascript”></script>
<script>ChiliPiper.scheduling(“account-name”, “example-router”, {
map: true,
onSuccess: ()=>{
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
'event': 'meeting_booked',
'formLocation': 'request_demo',
});
}
})
</script>
onError: function
This will call a function when a lead is submitted but does not match any queue rules and cannot be routed. Thus no calendar is displayed. This is usually when someone is disqualified from booking. A redirect can be/might have been specified within the Router UI under "Router Redirect," so this option is not always required and is used with more custom form integrations.
<script src="https://js.chilipiper.com/marketing.js" type="text/javascript"></script>
<script>ChiliPiper.scheduling("account-name", "example-router", {
onError: someFunction()
})
</script>
A sample use case of the above could be as simple as logging a console message:
<script src=“https://js.chilipiper.com/marketing.js” type=“text/javascript”></script>
<script>ChiliPiper.scheduling(“account-name”, “example-router”, {
map: true,
onError: ()=>{
//Log successful submission but no match
console.log(“We didn’t find a match”);
}
})
</script>
onClose: function
This will call a function when a lead is submitted and is displayed the option to book (meaning the lead has qualified for a meeting) but exits the booking module. A redirect can be/might have been specified within the Router UI under "Router Redirect," so this option is not always required and is used with more custom form integrations.
<script src="https://js.chilipiper.com/marketing.js" type="text/javascript"></script>
<script>ChiliPiper.scheduling("account-name", "example-router", {
onClose: someFunction()
})
</script>
A sample use case of the above could be as simple as logging a console message:
<script src=“https://js.chilipiper.com/marketing.js” type=“text/javascript”></script>
<script>ChiliPiper.scheduling(“account-name”, “example-router”, {
map: true,
onClose: ()=>{
//Log successful submission but Closed calendar
console.log(“Prospect didn't complete booking”);
}
})
</script>
onRouted: function
This will call a function when Chili Piper has received a lead's submission and a routing attempt has been made, whether successful or not. This will occur before the onSuccess, onError, or onClose functions are executed to indicate routing has begun.
<script src="https://js.chilipiper.com/marketing.js" type="text/javascript"></script>
<script>ChiliPiper.scheduling("account-name", "example-router", {
onRouted: someFunction()
})
</script>
A sample use case of the above could be as simple as logging a console message:
<script src=“https://js.chilipiper.com/marketing.js” type=“text/javascript”></script>
<script>ChiliPiper.scheduling(“account-name”, “example-router”, {
map: true,
onRouted: ()=>{
//Log successful routing after submission
console.log(“Prospect was routed”);
}
})
</script>