Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejs
document.addEventListener('readystatechange', function(event) {
    if (event && event.target && event.target.readyState === 'complete') {
        setTimeout(function() {
            if (webchattonic) {
                var metadata = {
                    firstName: 'Name',
                    lastName: 'Lastname'
                    'profile.id': 'Some external id'
                }
                webchattonic.updateMetadata(metadata);
            }
        }, 3000)
    }
})

Reset the conversation

Use webchattonic.resetConversation() to reset the current conversation, that will generate a new conversation as a new user. It is important to note that the user will be expired and cannot be recontacted.

Code Block
languagejs
document.addEventListener('logout', function(event) {
    if (event && event.target && event.target.readyState === 'complete' && webchattonic) {
        webchattonic.resetConversation();
    }
})