Skip to main content

JavaScript-Callback

The JavaScript callback function lets you react to events in the Online Assistant and execute your own logic — for example when a flow is completed.

Integration of own functions

The callback function can be used to react to various events in the assistant. The result object (res) contains the attributes event with the name of the event and the transaction data data.

<script type="text/javascript">
const licenceCode = "LL-XYZ123456789";
const options = {
selector: "#meister1"
}
Lokalleads.init(licenceCode, options, (res) => {
if(res.event === "init") {
console.log("The assistant has been loaded");
// TODO my implementation
}
if(res.event === "flow_completed") {
console.log("A request was generated", res.data.leadId);
// TODO my implementation
}
});
</script>

Events

The following events can be implemented:

NameDescription
initThe assistant has been loaded and is ready.
flow_completedThe results page of the Online Assistant was reached by the user.

Data

The following data is available:

NameDescription
idID of this transaction.
leadIdID under which this request can be found in the customer portal.
inputsData entered by the user.
caution

Other data in the data object should not be used and may change at any time.