Juanzo Posted June 1, 2011 Share Posted June 1, 2011 We are currently testing Olark as our live support platform and we are looking for ways to make it work better with WHMcs. They have a feature to include the visitor name, in case we already have it. To include it, they request to place the following code: <script type="text/javascript"> olark('api.chat.updateVisitorNickname', { snippet: "John Doe" }); </script> AFIK, {$clientsdetails.firstname} already prints client name. In order to include javascript at our footer.php template, we use the literal tags around the code but in this case, we need the name variable to be interpreted. Any ideas? 0 Quote Link to comment Share on other sites More sharing options...
ChuckB Posted June 23, 2011 Share Posted June 23, 2011 Try this: /* custom configuration goes here (www.olark.com/documentation) */ olark('api.visitor.updateFullName', {literal}{ fullName:{/literal} "{$clientsdetails.id} - {$clientsdetails.firstname}{$clientsdetails.lastname}"{literal}});{/literal} olark('api.visitor.updateEmailAddress', {literal}{ emailAddress: '{/literal}{$clientsdetails.email}{literal}' });{/literal} Put it below the line in your pasted JS code: /* custom configuration goes here (www.olark.com/documentation) */ Should be at the end, works like a charm, I included customer # too so I could do quick searches to bring up data - YMMV. 0 Quote Link to comment Share on other sites More sharing options...
laszlof Posted June 23, 2011 Share Posted June 23, 2011 Just use {ldelim} and {rdelim} rather than wrapping the whole thing in literal tags. Its a lot cleaner. <script type="text/javascript"> olark('api.chat.updateVisitorNickname', {ldelim} snippet: "{$clientdetails.firstname} {$clientdetails.lastname}" {rdelim}); </script> 0 Quote Link to comment Share on other sites More sharing options...
Juanzo Posted June 24, 2011 Author Share Posted June 24, 2011 Thanks for your reply guys! 0 Quote Link to comment Share on other sites More sharing options...
Juanzo Posted June 24, 2011 Author Share Posted June 24, 2011 (edited) Since the first name and email were bugged if client wasn't logged in, I tweak it to make it work properly: /* custom configuration goes here (http://www.olark.com/documentation) */ {/literal} {if $loggedin} olark('api.visitor.updateFullName', {literal}{fullName:{/literal} '{$clientsdetails.firstname} {$clientsdetails.lastname}'{literal}});{/literal} olark('api.visitor.updateEmailAddress', {literal}{emailAddress: '{/literal}{$clientsdetails.email}{literal}'});{/literal} {/if} {literal}olark.identify('REPLACE-WITH-YOUR-OLARK-ID');/*]]>{/literal}*/</script> <!-- end olark code --> I've tried using your solution Frank but couldn't make it work. The code doesn't look nice but it works. Edited June 24, 2011 by Juanzo Replaced our Olark ID 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.