When app is open for a while (could be a few seconds or a few minutes) it suddenly pops up unsolicited sans the background. Please see screenshots:
My initiation code:
try {
const TAWK_API_KEY = process.env.REACT_APP_TAWK_API_KEY;
window.Tawk_API = window.Tawk_API || {};
window.Tawk_LoadStart = new Date();
if (user?.email && TAWK_API_KEY) {
const visitorHash = await generateTawkHash(user.email, TAWK_API_KEY);
window.Tawk_API.visitor = {
name: `${user.firstName} ${user.lastName}`,
email: user.email,
hash: visitorHash
}
}
if (!document.getElementById('tawk-script') &&
process.env.REACT_APP_TAWK_PROPERTY_ID &&
process.env.REACT_APP_TAWK_WIDGET_ID) {
(function() {
var s1=document.createElement("script"),s0=document.getElementsByTagName("script")[0];
s1.async=true;
s1.src=`https://embed.tawk.to/${process.env.REACT_APP_TAWK_PROPERTY_ID}/${process.env.REACT_APP_TAWK_WIDGET_ID}`;
s1.charset='UTF-8';
s1.setAttribute('crossorigin','*');
s0.parentNode.insertBefore(s1,s0);
})();
}
} catch (error) {
console.warn('Tawk setup failed:', error);
}