Hey guys,
I’ve been trying to attach events to the Tawk_API variable after the widget is loaded, but to no avail.
I’ve added a very simple snippet of code to test events - “onChatMaximized” and “onChatMinimized” but to no avail.
I’ve added logs to the console to see the flow. Function calls work, however the call back events don’t seem to be getting attached.
Here’s the snippet which I’m using.
var Tawk_API = Tawk_API || {},
Tawk_LoadStart = new Date();
(function() {
var s1 = document.createElement("script"),
s0 = document.getElementsByTagName("script")[0];
s1.async = true;
s1.src = 'https://embed.tawk.to/65a675f58d261e1b5f53eaff/1hk93pi0b';
s1.charset = 'UTF-8';
s1.setAttribute('crossorigin', '*');
s0.parentNode.insertBefore(s1, s0);
Tawk_API.onLoad = function() {
Tawk_API.maximize();
console.log('Tawk_API.onLoad');
Tawk_API.onChatMaximized = function() {
console.log("Tawk_API.onChatMaximized");
};
Tawk_API.onChatMinimized = function() {
console.log("Tawk_API.onChatMinimized");
};
};
})();
Any help would be much much appreciated as I just can’t to see where the issue lies, and suspect it might something extremely silly.