Live Helper Chat support forum.. Old google groups forum can be found here

You are not logged in.

Announcement

#1 2020-10-23 10:53:38

Snake19
New member
Registered: 2020-10-23
Posts: 4

Can't add additional chat variables

Hi!
Please help with my question:

I added column "onlyname" (variable name - lhc.onlyname) and variable "onlyname" (JavaScript variable value - window.lhc_var.attr_str_1, Variable identifier - lhc.onlyname).  Then I chatted with bot for a while.
After that when I look at dashboard column "onlyname" is empty. What am I doing wrong?


             <script>
            if (typeof lhc_var === 'undefined'){ 
                window.lhc_var = {}; // Window is required to define variable in global scope
            }; 
            lhc_var.nick = 'my full name';
            lhc_var.email = ***.com';
            lhc_var.pin = '';
            lhc_var.phone = '';
            lhc_var.loginad = 'ad';
            lhc_var.usernamepassing = 'ad';
            lhc_var.attr_str_1 = 'my first name and middle name';
            var LHC_API = LHC_API||{};
            LHC_API.args = {mode:'widget',lhc_base_url:'//172.30.105.100/index.php/',wheight:450,wwidth:350,pheight:520,pwidth:500,leaveamessage:true,theme:1,check_messages:false,lang:'rus/'};
            (function() {
                var po = document.createElement('script');
                po.type = 'text/javascript';
                po.setAttribute('crossorigin','anonymous');
                po.async = true;
                var date = new Date();
                po.src = '//172.30.105.100/design/defaulttheme/js/widgetv2/index.js?'+(""+date.getFullYear() + date.getMonth() + date.getDate());
                var s = document.getElementsByTagName('script')[0];
                s.parentNode.insertBefore(po, s);
            })();
        </script>

Last edited by Snake19 (2020-10-23 10:53:56)

Offline

#2 2020-10-23 10:59:50

remdex
Administrator
From: Lithuania
Registered: 2012-09-23
Posts: 3,303
Website

Re: Can't add additional chat variables

Please read documentation how properly define define additional chat variables. It's addifional variable you are passing so lhc.onlyname is invalid.

Read
https://doc.livehelperchat.com/docs/cus … -chat-list

Offline

#3 2020-10-23 12:31:26

remdex
Administrator
From: Lithuania
Registered: 2012-09-23
Posts: 3,303
Website

Re: Can't add additional chat variables

I have added few more samples to be more explicit. Should clarify everything now.
https://doc.livehelperchat.com/docs/cus … -variables

Offline

#4 2020-10-26 03:53:51

Snake19
New member
Registered: 2020-10-23
Posts: 4

Re: Can't add additional chat variables

Thank you a lot, remdex! Now with "additional_data.myVariable" I can pass my variables.

Offline

#5 2020-10-26 04:43:03

Snake19
New member
Registered: 2020-10-23
Posts: 4

Re: Can't add additional chat variables

I've got simmilar question - how can I pass additional variables in bot messages. E.g. I want to bot to greeting me with my name (not full name) - "Hi, {additional_data.only Name}, welcome you!"
How can I do that?

Offline

#6 2020-10-26 04:58:11

remdex
Administrator
From: Lithuania
Registered: 2012-09-23
Posts: 3,303
Website

Re: Can't add additional chat variables

Offline

#7 2020-10-26 07:16:11

Snake19
New member
Registered: 2020-10-23
Posts: 4

Re: Can't add additional chat variables

Thanks! I got it via {lhc.add.myfield}.

Offline

Board footer