If you already know some information about your website visitors, for example if they’re logged into your membership site, you can easily pre-set their name, email, and additional information for Live Chat using some ninja Javascript code.
To make sure your code runs after our live chat has had a chance to initialize, use our FuseDesk Chat Namespace FuseDeskChatNS
one time.
Setting a Visitor’s Name
To set a customer or member’s name, use setClientName()
with the value of their name. For example, if your customer’s name was “Mr. Kilroy
“, you’d set it like so:
<script>
window.FuseDeskChatNS = function(FuseDeskChatNS) {
FuseDeskChatNS.setClientName('Mr. Kilroy');
}
</script>
Typically, you’ll have their name from your backend and can dynamically generate the above code or you’ll have their name in a different Javascript variable and will use that value.
Setting a Visitor’s Email Address
To set a customer or member’s email address, use setClientEmail()
with the value of their email address. This will help automatically link the chat to the right customer record. For example, if your customer’s name was “[email protected]
“, you’d set it like so:
<script>
window.FuseDeskChatNS = function(FuseDeskChatNS) {
FuseDeskChatNS.setClientEmail('[email protected]');
}
</script>
Typically, you’ll have their email address from your backend and can dynamically generate the above code or you’ll have their name in a different Javascript variable and will use that value.
Note that if you’re using our free WordPress plugin to embed the live chat widget, we can automatically set the name and email address for you.
Setting additional information about Live Chat Visitors
If you want to get really fancy, you can set additional meta information about your visitor to help your support agents get all the information they need. To set additional information, use setMetaData()
with an object of keys and values. For example, to set a Membership Level and Game Points:
<script>
window.FuseDeskChatNS = function(FuseDeskChatNS) {
FuseDeskChatNS.setMetaData({
membershipLevel: 'Silver',
gamePoints: 173
});
}
</script>
If you’re setting a key that already had a value, that value will be updated. If you’re setting a new key, it will be created.
Putting it All Together
You can of course combine all of these in one function like so:
<script>
window.FuseDeskChatNS = function(FuseDeskChatNS) {
FuseDeskChatNS.setClientName('Mr. Kilroy');
FuseDeskChatNS.setClientEmail('[email protected]');
FuseDeskChatNS.setMetaData({
membershipLevel: 'Silver',
gamePoints: 173
});
}
</script>