+ Start a Discussion
Han DaoHan Dao 

Adding Live Agent Chat Button to Self-Service Community

Hi all,

I'm putting together a community site using one of the new Winter '15 templates and looking to add a chat button/link that routes to a pre-chat form.  I've configured/generated the following live agent deployment and button code (IDs replaced with '*') and dropped it into an html element of the community: 

<a id="liveagent_button_online_***************" href="javascript://Chat" onclick="liveagent.startChat('***************')">Click here to chat with us!</a>
<div id="liveagent_button_offline_***************" style="display: none;">No agents are currently available.</div>
<script type="text/javascript">
if (!window._laq) { window._laq = []; }
window._laq.push(function(){liveagent.showWhenOnline('***************', document.getElementById('liveagent_button_online_***************'));
liveagent.showWhenOffline('***************', document.getElementById('liveagent_button_offline_***************'));
});
</script>
    
<script type='text/javascript' src='https://c.la3-c1-was.salesforceliveagent.com/content/g/js/31.0/deployment.js'></script>
<script type='text/javascript'>
liveagent.init('https://d.la3-c1-was.salesforceliveagent.com/chat', '***************', '***************');
</script>

I've tried this same code on a community page created from a custom Site.com template, and it works just fine.  When I use it on the community template, the link doesn't seem to recognize whether a chat agent is online, so it always displays the available message.  Also, when I click on the link, I get the message "Uncaught TypeError: Cannot read propert 'startChat' of undefined" using the Chrome console.

Any help would be greatly appreciated!
Abhinav S.Abhinav S.
Please follow the blog article mentioned at the below URL:-
http://www.infallibletechie.com/2013/06/live-agent-implementation-in-salesforce.html
This will works for you.
Han DaoHan Dao
Abhinav - Thanks for the link, but I've already tried these steps.  The code works fine on a community using Site.com pages, but doesn't appear to be working on a page created from a self-service template.
vinothvinoth
Hi Han Dao,
Is this issue is fixed? I am faction the same issue now. Can you provide me a solution?
Chris ChahinianChris Chahinian
I have found a solution, open the Self-Service Community in Site.com Studio > Edit the Main page > Expand Sripts on the right > Configure 'Edit Head Markup' >  Paste the Live Agent code in here.

 
Olivia Heidrick 5Olivia Heidrick 5
Does anyone have instructions on adding this to the Napili template?  I found this : https://success.salesforce.com/06930000004kBlK and followed it but when I go to preview, I don't see any chat buttons.  I see my homepage but nothing chat related.