Advanced button integration

In case you do not want to use visual functionality of LiveAgent buttons (floating, image, html) you can use any element on your site to start chat or contact form. To achieve this you have to:

1. Create a chat button

2. Modify "Button design"
- select "Custom html" style
- click "Customize design"
- change html code to "<span></span>" so button is not visible.

3. Save the button and get the integration code which will look like this:

<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.lc/LiveAgent/scripts/track.js',
function(e){ LiveAgent.createButton('6522fc2b', e); });
</script>

Change the code so it looks like this (remember to use correct URLs and button id):

<script type="text/javascript">
var chatButton;
(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.lc/LiveAgent/scripts/track.js',
function(e){ chatButton = LiveAgent.createButton('6522fc2b', e); });
</script>

Now you can simulate click on the button by calling following javascript:

chatButton.onClick();

Example:

<h2 class="alt" onClick="chatButton.onClick();">Start chat</h2>