How can I change visitor data?

During an active chat

If a visitor has logged into your website, can use the profile data. So your agents will know with whom they have the conversation.

Using JS SDK

This method from the JS SDK can be called to change visitor’s parameters from your front-end:

txtme.api.setCustomUserParams({name: 'Visitor', email: '[email protected]'});

If you are not sure if the chatbox has already been initialized or not, then hook to the txtmeReady event:

window.addEventListener('txtmeReady', function(){
   let txtmeUserParams = {        
            name: 'Visitor',              // optional
            email: '[email protected]'     // optional
}, false);

Both name and emails parameters are optional, you can change just name or just email.
The change is instantaneous, the agents in the

When initializing a chatbox

Using JS SDK

When creating a new chatbox, it is possible to pass an array of parameters including visitor’s data.
Use the following code as an example. Replace the 00000000000000000000000000000000 with your widget’s id.

<script type="text/javascript">    
    window.txtmeData = {
        user: {
            name: 'Visitor',
            email: '[email protected]'
    (function (w,d,c,i) {
        var n = d.getElementsByTagName('script')[0],
            s = d.createElement('script');
        s.src = '' + i;
        s.type = 'text/javascript';
        s.async = true;
        n.parentNode.insertBefore(s, n);

Related Posts

Was this page helpful?
In this Article