Web Widget/Help Center : Can the web widget just be a link that redirects to the help center once clicked? | Community
Skip to main content

Web Widget/Help Center : Can the web widget just be a link that redirects to the help center once clicked?

  • March 31, 2022
  • 13 replies
  • 0 views

We would like to see if the web widget can just link directly to the help center when the icon is clicked on our website. Is that possible?

13 replies

Tipene
  • March 31, 2022
Hi Salim,
 
The web widget isn't really intended to function that way. Creating a custom element in your page modeled on the web widget appearance might be more in line with the functionality you're looking for. If there's a specific use case you're trying to solve for, let me know and we can look further in to it.
 
Tipene

  • Author
  • April 1, 2022

The user case in this scenario is that rather than giving the ability to the customer to search articles through the widget and have the contact form available. If they click the web widget icon it redirects to the help center . Mostly for article formatting, videos, etc.

It also adds an extra step for the customer to try harder to find their answer rather than just defaulting to the "contact us" button after a simple search on the web widget.


Tipene
  • April 4, 2022
Hi Salim,
 
Thanks for sharing.
 
Adding something like this to the website code would achieve what you're looking to do:
 
<script type="text/javascript">
  zE("webWidget:on", "open", function () {
    return window.location.href = "https://www.{your_help_center}.zendesk.com"
  });
</script>
 
 

  • Author
  • April 5, 2022

Thank you!

 


  • Author
  • April 12, 2022

Few other questions @tipene would this open the help center in a new tab or the existing one? Also would the code replace the standard web widget code snippet or just add to it and does the position where it's added matter?


Hi Salim,
 
This will open the Help Center in the same tab.  Also, it would not replace the launch snippet copied from the admin settings.  Include this code after that snippet.

  • Author
  • April 25, 2022

Hi @christopher53

Would it be possible to have it open in a new tab rather than the same tab?

 


Eric27
  • April 27, 2022
Hey Salim,

You'd just switch it to use "window.open":
 
 
<!-- Start of Zendesk Widget script -->
<script id="ze-snippet" src="https://static.zdassets.com/ekr/snippet.js?key=123"> </script>
<!-- End of Zendesk Widget script -->
<script type="text/javascript">
zE("webWidget:on", "open", function () {
return window.open('https://{your_help_center}.zendesk.com', '_blank');

});
</script>

Thanks!

  • Author
  • June 10, 2022

Hi @eric27 , @tipene,

So we implemented the code and it does redirect to the help center when the web widget is clicked which is great! However, when you go back to the website where the web widget lives, the contact form is automatically opened. Is there a way to keep the widget in its original state and not have the form open when clicked?

 


Eric27
  • June 13, 2022
Hey Salim,

You'd want to use the close command from the web widget api to do this.

  • Author
  • June 13, 2022

Thanks @eric27, and would this be applied to the original Zendesk widget snippet or the modifications we made to have it open the help center if clicked?

 

Would I simply change 

zE("webWidget:on", "open", function () {

TO

zE("webWidget:on", "close", function () {

 


Eric27
  • June 14, 2022
Hey Salim,

If you want users to always get redirected to the help center you'd use this:

 
<script type="text/javascript">
zE("webWidget:on", "open", function () {
zE('webWidget', 'close'); 
window.open('https://example.zendesk.com', '_blank');
})
</script>

If you want users to be able to use the web widget / contact form after their first redirect you'd use something like this:

 
  <script type="text/javascript">
let clicks = 0
zE("webWidget:on", "open", function () {
if (clicks === 0) {
zE('webWidget', 'close');
clicks++
window.open('https://example.zendesk.com', '_blank');
}
})
</script>

This keeps track of the amount of clicks on the web widget button. Then if it's been clicked once or more, it'll open the web widget as normal instead of redirecting.

Hope this helps,

  • Author
  • June 15, 2022

Awesome, thank you @eric27 , that should work to stop the contact form from opening after the button is clicked.

Thanks as well for the second suggestion!