timed chat opener
Wed Dec 04 2024 18:50:55 GMT+0000 (Coordinated Universal Time)
Saved by
@FOrestNAtion
<script>
const hasSeenKey = 'hasSeenChat';
const expiryKey = 'hasSeenChatExpiry';
const expiryInHours = 24; // set your desired time limit
// Check if user has opened the chat before and if data is still valid
const hasSeenBefore = localStorage.getItem(hasSeenKey);
const expiryTime = localStorage.getItem(expiryKey);
const now = Date.now(); // current timestamp in milliseconds
const expiresAt = expiryTime ? parseInt(expiryTime, 10) : 0;
// If not seen before or if the current time has passed the stored expiry
if (!hasSeenBefore || now > expiresAt) {
// Setup and show the chat
ktt10.setup({
id:"5H1KphMy28cG",
accountId:"1061315",
color:"#009A42",
icon:"https://res.cloudinary.com/drt2tlz1j/image/upload/v1733333698/ai_qyquca.svg"
});
setTimeout(function() {
ktt10Btn.click();
localStorage.setItem(hasSeenKey, 'true');
localStorage.setItem(expiryKey, (now + expiryInHours * 60 * 60 * 1000).toString());
}, 3500);
}
</script>
content_copyCOPY
Comments