Fylla i kundernas namn och e-post automatiskt

Prefill email and name for customer

When your chat button or contact form is integrated within your CMS you usually already know the e-mail address and name of your customer so you do not need to ask for it in a contact form.
You can prefill both the e-mail address, name or phone of the customer or any custom value by adding some special code to your widget code.

 

And now a quick one-line solution examples...

Chat buttons

Regarding chat buttons, you are supposed to modify the original integration code

<script type="text/javascript">
(function(d, src, c) { var t=d.scripts[d.scripts.length - 1],s=d.createElement('script');s.id='la_x2s6df8d';s.async=true;s.src=src;s.onload=s.onreadystatechange=function(){var rs=this.readyState;if(rs&&(rs!='complete')&&(rs!='loaded')){return;}c(this);};t.parentElement.insertBefore(s,t.nextSibling);})(document,
'//URL_TO_LiveAgent/scripts/track.js',
function(e){ LiveAgent.createButton('16756da8', e); });
</script>

this way:

<script type="text/javascript">
(function(d, src, c) { var t=d.scripts[d.scripts.length - 1],s=d.createElement('script');s.id='la_x2s6df8d';s.async=true;s.src=src;s.onload=s.onreadystatechange=function(){var rs=this.readyState;if(rs&&(rs!='complete')&&(rs!='loaded')){return;}c(this);};t.parentElement.insertBefore(s,t.nextSibling);})(document,
'//URL_TO_LiveAgent/scripts/track.js',
function(e){ 
LiveAgent.setUserDetails('customer@email.com', 'First name', 'Last name'); 
LiveAgent.createButton('16756da8', e);
});
</script>

 

The row with bold letters

LiveAgent.setUserDetails('customer@email.com', 'First name', 'Last name'); 

was the one that was added to the original integration code.

 

Contact form

Regarding contact forms it is the same - if you compare the contact button and contact form code, then you will notice, that the only change is this:

LiveAgent.createButton()  there is LiveAgent.createForm() so there is no difference between applying the above mentioned integration to a contact button code or to a contact form code. 

 

Note: This integration is available for version 2.4 and higher.

 

Phone support

Since version 4.3.7.2 you can also prefill phone number in user details. This is the function form:
LiveAgent.setUserDetails(email, firstName, lastName, phone)