đŠ Callbacks
Tags: JavaScript, React, Vue, Angular, Website, Web App
Use the following callbacks to get notified on certain state changes of the Gleap widget. This enables you to create an even deeper integration with Gleap.
On initializedâ
This allows you to get notified once Gleap is initialized and ready.
Gleap.on("initialized", () => {
console.log("Gleap got initialized and is ready :)");
});
On notification count updatedâ
This allows you to get updates on the unread notification count.
Gleap.on("unread-count-changed", (unreadCount) => {
console.log("unread-count-changed", unreadCount);
});
On openâ
This allows you to get notified once Gleap opens.
Gleap.on("open", () => {
console.log("Gleap did open.");
});
On closeâ
This allows you to get notified once Gleap closes.
Gleap.on("close", () => {
console.log("Gleap did close.");
});
On product tour completedâ
This allows you to get notified once a product tour gets completed.
Gleap.on("productTourCompleted", (data) => {
console.log(data);
});
On conversation startedâ
This allows you to get notified when the user starts a new conversation (with or without a bot workflow).
Gleap.on("conversation-started", (data) => {
console.log("User started a new conversation with optional workflow.");
console.log(data.workflowId);
});
On feedback sentâ
This allows you to get notified once feedback is sent.
Gleap.on("feedback-sent", (formData) => {
console.log("Gleap did send a feedback item.");
console.log(formData);
});
On outbound sentâ
This allows you to get notified once a survey got answered.
Gleap.on("outbound-sent", (outboundData) => {
console.log("Gleap did send survey results.");
console.log(outboundData);
});
On flow startedâ
This allows you to get notified once a Gleap flow is started.
Gleap.on("flow-started", (flow) => {
console.log("The user selected a flow");
console.log(flow);
});
On error while sending feedbackâ
This allows you to get notified if an error occurs while Gleap is trying to send a feedback item.
Gleap.on("error-while-sending", () => {
console.log("Ouch, something went wrong.");
});