Segment end users to see live chat option
Hi Zens,
We want to establish a specific route for our end-users to reach a live chat feature as this is a paid add on that we offer to clients. Is there a way to segment end-users either by organisation, tags, segments etc. that we can set per each end user so they see live chat and others don't?
So the journey would be:
1. Client logs in on the Guide and becomes an End-User
2. The client would interact with the answer bot and if not resolved they can 'Get in touch'
IF the end-user is tagged as VIP or segmented in some way AND live chat is ON then
3. They then should see live chat feature
ELSE if the end-user is not tagged or segmented and live chat is ON then
4. They just get a Request a Ticket form to fill in.
Is this doable and has anybody achieved anything like this?
Thanks in advance!
Nikita
-
Hi Nikita 👋
Yep, this is perfectly doable.
Here's how the script in your Help Center Template could work.
Now you only need to add tag to the User in Zendesk Support. Either via a custom field that has a tag or via the tag property on the user.
In the widget there is a setting to hide the widget when nobody's online.window.zESettings = {
webWidget: {
chat: {
hideWhenOffline: true,
suppress: true,
}
}
};
// only execute script if user is not "anonymous" (in other words, is logged in)
if (HelpCenter.role !== 'anonymous') {
if (HelpCenter.user.tags.includes('brand_y'){
// add the widget script here to include your chat
updateWebWidget();
}
}
function updateWebWidget(){
zE('webWidget', 'updateSettings', {
webWidget: {
chat: {
suppress: false,
}
}
});
} -
That's amazing, thanks so much!
How would I add this to the Help Centre, do I just add the widget code and change it in the header.hbs?
Thanks you,
Nikita
-
I am just a little confused where the code needs to be included, I have added it now to the Web Widget but it still seems to show Live Chat to anonymous users.
I just clicked the Add to help centre button on the widget and replaced the code with the one above and changed this bit to include the widget and changed the tag from brandy_y in your example to the actual tag:
// add the widget script here to include your chat
Any help would be appreciated!
-
Just as an update, I have managed to get it working with a help of a Zendesk agent:
This code basically did what I needed, hope this helps anyone who wants to achieve a similar user journey:
You need to add 2 pieces of code into script.js file in Help Centre.
Place Part A before before the
document.addEventListener('DOMContentLoaded', function() {
line and Part B after it:window.zESettings = {
webWidget: {
chat: {
suppress: true
}
}
}if (HelpCenter.user.role !== 'anonymous') {
if (HelpCenter.user.tags.includes('VIP')){
zE('webWidget', 'updateSettings', {
webWidget: {
chat: {
suppress: false
}
}
})
}
}
I have made further customisations from here to suppress talk and chat depending on the type of tagged user that's signed in. Btw, the tag name can be whatever you want it to be.Here is a good article that goes into more detail about the suppress option in the API: https://developer.zendesk.com/embeddables/docs/widget/settings
Hope this helps!
Nikita
Please sign in to leave a comment.
4 Comments