Question
Is it possible to completely hide the department field called Choose a department on the pre-chat form?
Answer
There is no native setting that will remove the department field entirely. In your pre-chat form settings, unchecking Require Department doesn't remove the field from the pre-chat form but it will make it optional.
However, you can hide the department field from visitors by using the Departments API end-point with an empty array.
<script type="text/javascript"> window.zESettings = { webWidget: { chat: { departments: { enabled: [] } } } }; </script>
Simply add the above code after your widget script on your website. It will look something like this:
<script id="ze-snippet" src=[your widget key here]> </script>
<script type="text/javascript">
window.zESettings = {
webWidget: {
chat: {
departments: {
enabled: []
}
}
}
};
</script>
This code prevents any visitors from seeing the department dropdown and therefore from selecting a department. It does not remove the department functionality from the chat entirely. You can still assign a department to a chat request on the back end using a trigger or the departments.select function.
For more information, see this article: Automatically route chats to departments.
15 Comments
Make sure that the department you mention in the settings has
Hey, you have no control over the webpage where this code loads, so you can’t use the custom widget code there.
Best practice is embedding the widget code on your website directly in the head or footer.
The way to accomplish this is to define one default department in both the selected and enabled field:
Hi there
We have two separate widgets each managed by a specific department (lets say Sales and Support).
Following the guidelines above I was able to hide the department field on the pre-chat form of both widgets and set departments selection
Problem is that now the widgets show the offline form (with its welcome message) only when all the agents are offline.
For example If some of Sales agents are online and all Support agents are offline, both widgets show the pre-chat module and on the Support widget it sends an email once compiled instead of starting the chat (as expected but no explanation in the form). I would rather expect that the widget whose agents are offline would show the offline form.
Moreover if I also add a script to load a custom badge image on one of the two widgets (the other one uses the image specified in the Chat setup)
the previous setup seems to be ignored, and the drop down menu for choosing the department appears again.
Any help will be appreciated, thank you!
Hi,
I read both these urls:
https://support.zendesk.com/hc/en-us/articles/115010352968
https://support.zendesk.com/hc/en-us/articles/360022184994?page=1#comment_360004897033
But it's still not work on my end.
I also try to update enabled: [''] to enabled: [] or remove enable field. But it's not work at all.
Authenticated users have all the data of the their current profiles. This can automatically be done if your Help Center will require users to sign in.
Another option is to use Enabling authenticated visitors in the Chat widget.
Are there plans to have the widget remember or automatically collect data from existing users?
Hi, I used the above code and it worked fine on our Help Center. However, we are using a link to Chat on our website, instead of the widget, and department still shows when clicking the link.
I urgently need to get this hidden. How can I update it so that it will no show department from the link either please. The link we are using is:
https://static.zdassets.com/web_widget/latest/liveChat.html?v=10#key=subdomain.zendesk.com
Thanks,
Steven.
Hi Davide,
Good day! It looks like you've assigned a department to each of your widgets and you would like to set the widget status depending on the status of the department assigned.
If this is the case, you can use the API script mentioned here Can I configure the Web Widget to present Chat on my webpage only when a specific department is online?
I hope this helps.
Regards,
Adrian
I tried.
The button is not say "Chat" any more. It says "Help"
Thomas (internalnote.com) Thanks for clarifying!
Hey Adrian
This worked beautifully, thank you! I totally missed that script.
Thanks again,
Davide
Awesome, It hided.
Many thanks
Hi, I try to filter the departments in widgets.
But department is not shown if both the selected and enabled propety set.
When function sets either fields, department is shown.
The following code does not work:
"hr" is shown in department but default value is "---":
Yes, this is expected behavior. When there's only one option for a department and it is already selected, then the chat department field becomes hidden since the visitors won't be able to interact with it. Also, the department is automatically set in this kind of configuration so in your case, the chat department "hr" is automatically set.
Please sign in to leave a comment.