Home > How to: Hide button on mobile

Categories: |


(Last Updated On: June 28, 2017)

If you are wanting to hide the mobile button, you will need to edit the code snippet you place on your website. Below are 2 options for doing this.


Use this snippet to hide the button on mobile AND disable proactive chat

<!-- begin SnapEngage code -->;
<script type="text/javascript">
  (function() {
    var se = document.createElement('script'); se.type = 'text/javascript'; se.async = true;
    se.src = '//storage.googleapis.com/code.snapengage.com/js/XXXXXXXXXXXXXXXXXXXXXXXXXXX.js';
    var done = false;
    se.onload = se.onreadystatechange = function() {
      if (!done&&(!this.readyState || this.readyState === 'loaded' || this.readyState === 'complete')) {
        done = true;

        /* Place your SnapEngage JS API code below */
        if (navigator.userAgent.match(/(iPhone|iPod|iPad|BlackBerry|Android|IEMobile)/)) {
          SnapEngage.hideButton();
          SnapEngage.allowProactiveChat(false);
        }
      }
    };

    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(se, s);
  })();
</script>
<!-- end SnapEngage code —>


Use this snippet to hide the button on mobile AND allow proactive chat

<!-- begin SnapEngage code -->
<script type="text/javascript">
  (function() {
    var se = document.createElement('script'); se.type = 'text/javascript'; se.async = true;
    se.src = '//storage.googleapis.com/code.snapengage.com/js/XXXXXXXXXXXXXXXXXXXXXXXXXXX.js';
    var done = false;
    se.onload = se.onreadystatechange = function() {
      if (!done&&(!this.readyState || this.readyState === 'loaded' || this.readyState === 'complete')) {
        done = true;

        /* Place your SnapEngage JS API code below */
        if (navigator.userAgent.match(/(iPhone|iPod|iPad|BlackBerry|Android|IEMobile)/)) {
          SnapEngage.hideButton();
        }
      }
    };

    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(se, s);
  })();
</script>
<!-- end SnapEngage code -->

Did you find this article helpful?

Not HelpfulNeeds WorkSo-soHelpfulVery Helpful (No Ratings Yet)
Loading ... Loading ...

Published June 23, 2017