On this page
チャット開始と終了イベント
チャットの開始時または終了時に独自のJavaScriptコードを実行するには、チャットボタンの統合コードをカスタマイズできます(太字で示されている部分がカスタマイズ箇所で、それ以外は標準のチャットボタン統合コードです):
<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>