Building the mind for your business
Please follow these integration steps:
For more information see Hubspot developer portal
// Configure hubspot to load without displaying the FAB.
// This should ideally be executed before Hubspot.
if (window.HubSpotConversations) {
window.hsConversationsSettings = {
loadImmediately: false,
};
}else {
window.hsConversationsOnReady = [
() => {
window.hsConversationsSettings = {
loadImmediately: false,
};
},
];
}
// Hide Hubspot when needed.
function hideHubspot() {
if (!window.HubSpotConversations)
return;
window.HubSpotConversations.widget.remove();
}
// Show Hubspot when needed.
function loadHubspot(open) {
if (!window.HubSpotConversations)
return;
window.HubSpotConversations.widget.load({
widgetOpen: open
});
window.HubSpotConversations.on('conversationClosed', payload => {
console.log('windows.Hubspot.off');
hideHubspot();
kare.showLauncher();
});
}
window.GLR = {
appId: '<APP-ID>'
};
(function (w, d, s) {
var j = document.createElement(s); j.async = 1; j.type = 'text/javascript'; j.src = 'https://widget.eu.karehq.com/latest.js';
w.GLR = w.GLR || {};
d.getElementsByTagName('head')[0].appendChild(j);
j.addEventListener('load', () => {
kare.onLoad(function(callbackEvent) {
console.log('my custom onLoad callback');
});
kare.onClose(function (callbackEvent) {
console.log('my custom onClose callback');
});
kare.onEscalate(function (callbackEvent, messageBody) {
console.log('my custom onEscalate callback');
kare.close();
kare.hideLauncher();
loadHubspot(true);
});
kare.onOpen(function (callbackEvent) {
console.log('my custom onOpen callback');
});
kare.onBeforeSocketOpen(function (callbackEvent) {
console.log('my custom onBeforeSocketOpen callback');
});
hideHubspot();
});
})(window, document, 'script');