Start and Close chat events

To execute own javascript code when chat is started or closed, you can customize chat button integration code (with bold is marked our customization, the rest of the code is standard chat button 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,

'//localhost/LiveAgent/LiveAgent/server/scripts/trackjs_dev.php',

function(e){

var mybutton = LiveAgent.createButton('4c1d0e9f', e);

mybutton.oldOnClick = mybutton.onClick;
mybutton.oldOnCloseFunction_ = mybutton.onCloseFunction_;

mybutton.onClick = function() {
     mybutton.oldOnClick(); 
     //here is your code after chat is started, e.g. measure the size of chat window:
     console.log(mybutton.chat.element.offsetHeight);
     console.log(mybutton.chat.element.offsetWidth);
};

mybutton.onCloseFunction_ = function() {
     mybutton.oldOnCloseFunction_(); 
     //put here your javascript code executed after chat is closed
 }});

</script>

 

Ready to try LiveAgent?

It's free for the first 14 days! No credit card required.

Get Started
We work well with others...
Magento Joomla Wordpress Mailchimp
Contact us

support@ladesk.com

+1-800-811-6590 (Toll Free in USA & Canada)

+421 2 33 456 826 (European Union & Worldwide)

Quality Unit, LLC 616 Corporate Way, Suite 2-3278 Valley Cottage, NY 10989

Stay in touch
Blog Google+
© 2004-2015 QualityUnit.com, All rights reserved