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

13 Kommentare

  • Tipene Hughes
    Zendesk Developer Advocacy
    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>
     
     
    1
  • Eric Nelson
    Zendesk Developer Advocacy
    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!
    1
  • Tipene Hughes
    Zendesk Developer Advocacy
    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
    0
  • Salim Moumouni

    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.

    0
  • Salim Moumouni

    Thank you!

     

    0
  • Salim Moumouni

    Few other questions Tipene Hughes 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?

    0
  • Christopher Kennedy
    Zendesk Developer Advocacy
    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.
    0
  • Salim Moumouni

    Hi Christopher Kennedy

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

     

    0
  • Salim Moumouni

    Hi Eric Nelson , Tipene Hughes,

    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?

     

    0
  • Eric Nelson
    Zendesk Developer Advocacy
    Hey Salim,

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

    Thanks Eric Nelson, 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 () {

     

    0
  • Eric Nelson
    Zendesk Developer Advocacy
    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,
    0
  • Salim Moumouni

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

    Thanks as well for the second suggestion!

    0

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.

Powered by Zendesk