Jump to content

Integration with Olark


Juanzo

Recommended Posts

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?

Link to comment
Share on other sites

  • 4 weeks later...

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.

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

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 by Juanzo
Replaced our Olark ID
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated