How to show the Web Widget On Click

Have more questions? Submit a request

9 Comments

  • Meghan Mahar
    Comment actions Permalink

    Hi Anna. This may be exactly what I'm looking for. When the widget appears, will it show the widget button that users will need to then click or will the widget be open automatically?

    0
  • rjones
    Comment actions Permalink

    Unfortunately, this merely hides the widget button then shows it. I'm also looking for a way to launch the widget without using the default button.

    0
  • rjones
    Comment actions Permalink
    If you want to hide the button follow the steps given above but in Step 7. instead of 
    zE.show();

     use this:
    zE.activate({hideOnClose: true});

     
     
    0
  • Laksh Parab
    Comment actions Permalink

    This requires to load widget script on every page, and then just show or hide on click event. Is there anyway to load widget from zendesk on click event and them immediately activate it?

    0
  • Eric Ypsilantis
    Comment actions Permalink

    Laksh ended up following up in a ticket, but I wanted to share what I suggested here as well for those reading the article. We support the option to use Google Tag Manager to inject the embed snippet, per this documentation:

    https://developer.zendesk.com/embeddables/docs/widget/gtm

    So you would be able to use the "Fire On Step" logic in GTM to determine when to add the necessary embed codeblock and other custom code you wish to implement. I hope this helps out with your customization efforts!

    0
  • Laksh Parab
    Comment actions Permalink

    @Eric But that will increase application dependencies on third party controls

    Krassmann, Konstantin has suggestion here

     

    I have not tried it.

    Solution: Dont forget to set the ID of the inserted script Tag ("ze-snippet")

    var s,
    r,
    t;
    r = false;
    s = document.createElement('script');
    s.id="ze-snippet";
    var head = document.getElementsByTagName("head")[0];
    head.appendChild(s);
    s.type = 'text/javascript';
    s.src = <your url with key>;
    0
  • Giladiskon Support
    Comment actions Permalink

    Can anyone confirm whether the button link can open an active chat window or just show the widget button? Thanks.

    0
  • Brett - Community Manager
    Comment actions Permalink

    Hi Giladiskon Support,

    There isn't a way to accomplish this natively, however, you may be able to set this up using the Chat API. I'd recommend you take a look at our Product Managers comment in the following post which addresses this: How to trigger a chat after the user clicks on the widget

    Hope this helps!

    0
  • Eric Uldall
    Comment actions Permalink

    In case someone else comes across this somewhat old thread and still wants to be able to programmatically open the web widget, I've used the following which works fine...

    document.getElementById('launcher').contentWindow.document.getElementById('Embed').getElementsByTagName('button')[0].click();

     I can't guarantee how long this will work as I doubt Zendesk would consider this method "officially supported", so use it at your own risk.

    0

Please sign in to leave a comment.

Powered by Zendesk