När din chattknapp eller ditt kontaktformulär är integrerad i befintlig CMS, vet du oftast redan kundens namn eller e-post och behöver då inte fråga om detta igen i ett annat kontaktformulär. Använd följande kod i integreringen.
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)
LiveAgent.setUserDetails(email, firstName, lastName, phone)