Hi!
Thank you for writing in.
While we do not have a built-in option like that, as the chat history is saved in the local storage of the web browser – we do have a workaround for it.
Please simply paste this code and change the “PK” from the ‘tidio_state_PK’ to your own Public Key which can be found in the Developer section of Tidio. https://www.tidio.com/panel/settings/developer
After the code is injected correctly – it will clear the whole chat after reloading the page.
window.addEventListener('beforeunload', function(){
const stateKey = 'tidio_state_PK';
const state = JSON.parse(localStorage.getItem(stateKey));
console.log(state.messages)
const newState = {...state, messages: []}
localStorage.setItem(stateKey, JSON.stringify(newState));
})
Hello,
okay but i’m so sorry i dont understand where i have to put this code and what i do with the “PK”
https://my.hidrive.com/lnk/DBRkLlTx
here are the settings and where must i put the this code?
window.addEventListener('beforeunload', function(){
const stateKey = 'tidio_state_u3abhqrefntf1eidhqkakxnno6vecorr';
const state = JSON.parse(localStorage.getItem(stateKey));
console.log(state.messages)
const newState = {...state, messages: []}
localStorage.setItem(stateKey, JSON.stringify(newState));
})
Hi! Thank you for writing back.
In your case the code should be as above – you can put it below Tidio code in your page.
I’ll be here in case of any further questions!
Hello,
https://my.hidrive.com/lnk/ByRELHNq
i put this code see in the pic into footer.php
But it doesnt’s clear the chat after Reloading the page.