Launch on a link click
Launch Intellichat on a link click
Sometimes you may want to launch your chat window when a user clicks a specific link on your page. This is possible by configuring your Intellichat instance, and then launching the chat using a custom javascript function.
In order to launch your chat, the first stage is to setup the link which you will use to launch your chat window.
To achieve this we use the 'onclick' event handler. This event handler can be added to multiple links on the page if needed:
So that intellichat is included on your page, you need to ensure that the script is called within your HTML directly, though an inline <script> tag. Be sure to replace 'YOUR_CID' with the campaign id of your Intellichat campaign.
The final stage of the setup is to set the default values for Intellichat and then create your function which will launch it, hooking into the 'onclick' event handler we created earlier.
<script type='text/javascript'>
var IntelliChatLaunched = 'false';
var IntelliChatOpen = 'false';
if(intellichat.Customise){
intellichat.Customise.OnReady = function(){
intellichat.Actions.RemoveChat();
}
intellichat.Customise.OnClose = function(){
IntelliChatOpen = 'false';
}
}
</script>
Finally we create the function to pull everything together and launch the chat.
<script type='text/javascript'>
function LaunchChat(){
if(IntelliChatOpen == 'true'){
alert('Our Live chat is already activated.');
}else{
if(IntelliChatLaunched != 'false'){
intellichat.ChatWindow.Launched = false;
intellichat.ChatWindow.CanActivate = true;
intellichat.Conversation.MessageQueue = new Array();
intellichat.Components.ChatLog.innerHTML = '';
intellichat.Conversation.ClearQueue();
}
if(intellichat.Actions){
IntelliChatLaunched = true;
intellichat.Actions.EnableChat();
intellichat.Actions.LaunchWindow(true);
IntelliChatOpen = 'true';
}else{
alert('Sorry, Live chat is unavailable at this time.');
}
}
}
</script> Intellichat is trusted by:
Loading...