Skip to content

Instantly share code, notes, and snippets.

@grantmiller
Last active October 12, 2015 09:18
Show Gist options
  • Save grantmiller/4004805 to your computer and use it in GitHub Desktop.
Save grantmiller/4004805 to your computer and use it in GitHub Desktop.
LP Mobile Aysnc Advanced Integration Options
<script type="text/javascript">
/* LP Mobile JS Configuration */
var _LP_CFG_ = {
app_id : "YOUR_MOBILE_SITE_ID",
options : {
// All configuration options defined in here
//chatDisabled : true, // Only to be used on unsupported pages
triggerSelector : '.help-btn', // Replace with a selector to your help button(s)
extras : function() { // A static dictionary or a function that returns a dictionary of custom variables
var extras = {'varName1': 'varValue1',
'varName2': 'varValue2'};
return extras;
},
onChatDisabled : function(els) { // An event that fires when chat is disabled. It takes one parameter which is an array of your trigger selectors.
for(var i = 0; i < els.length; i++) {
els[i].style.opacity = .5;
}
},
onChatEnabled : function(els) { // An event that fires when chat is enabled. It takes one parameter which is an array of your trigger selectors.
for(var i = 0; i < els.length; i++) {
els[i].style.opacity = 1;
}
},
onChatNotAnswered : function(messages) { // An event that fires after a message is sent by the user but agents are no longer available. It takes one parameter which is an array of the messages attempted to be sent by the user.
alert('All chat agents are currently helping other customers. Please call our customer service center at 800-555-5555');
}
}
};
/* End of Configuration */
/* LP Mobile JS include */
(function(){var a=_LP_CFG_.lpjsid="lpjs-"+(new Date).getTime(),b=document.createElement("script"),s=document.getElementsByTagName("script")[0];b.id=a;b.type="text/javascript";b.async=true;b.src="https://d3tpuxked45kzt.cloudfront.net/lp_lib/liveperson-mobile.js";s.parentNode.insertBefore(b,s)})();
/* End of Include */
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment