Support » Developing with WordPress » Open show live chat after click button

  • Hello,

    I have a live chat code “smartsupp”

    var _smartsupp = _smartsupp || {};
    _smartsupp.key = 'f15f********0aa85b********c5149dcb3b72';
    window.smartsupp||(function(d) {
      var s,c,o=smartsupp=function(){ o._.push(arguments)};o._=[];
      s=d.getElementsByTagName('script')[0];c=d.createElement('script');
      c.type='text/javascript';c.charset='utf-8';c.async=true;
      c.src='https://www.smartsuppchat.com/loader.js?';s.parentNode.insertBefore(c,s);
    })(document);
    </script>
    

    and I can add it to the website so that the chat window is always displayed.
    But I would like to make the chat window appear only after clicking the button “CZAT Z DORADCĄ”.

    Button screen

    I tried to add a button that will run javascript but something doesnt work.

    My question is how to create a button that will do this?

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    The code currently executes when the page loads. To prevent it from executing right away, you could place the code within your own function. To get your function to execute on click, create an HTML element that looks like a button. It doesn’t really need to be an actual button. Any HTML element someone could click on would suffice. Add an onclick attribute to that element which calls the function you created.

    That’s the general idea anyway. The chat window is actually inserted by the loader.js script from the smartsupp site. I’ve no idea what it actually does, so there could be some flaw in the general idea that I described. If you continue to have difficulty, I recommend seeking assistance from smartsupp. They’re the ones who best knows what their script actually does.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.