Skip to content

Instantly share code, notes, and snippets.

@pi3r
Last active December 22, 2015 10:58
Show Gist options
  • Save pi3r/6462228 to your computer and use it in GitHub Desktop.
Save pi3r/6462228 to your computer and use it in GitHub Desktop.
Zendesk Feedback Tab with SnapEngage

1. Create a Feedback Tab with the following Custom Css:

</style>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script>
  var j = jQuery.noConflict();
  j(document).ready(function(){
    j('.preferChat').prop({ href: "#snapengage" });
    j('.preferChat').on('click', function(e){
      e.preventDefault();
      parent.window.Zenbox.hide();
      parent.window.SnapEngage.startLink();
    });
  });
</script>
<style>

2. Create a Javascript widget with the Feedback Tab code in it.

3. Create a Javascript widget with the following code in it:

</script>
<script type="text/javascript">
(function() {
  var done = false,
      se = document.createElement('script'),
      s = undefined;
      
  se.type = 'text/javascript'; 
  se.async = true;
  se.src = '//commondatastorage.googleapis.com/code.snapengage.com/js/xxxxxx-xxxxx-xxxxxx-xxxxxx.js';// Replace with your id.
  se.onload = se.onreadystatechange = function(){
    if(!done&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){
      done = true;
      SnapEngage.hideButton();
      SnapEngage.allowProactiveChat(false);
      SnapEngage.setCallback('Close', function (type, status) {
        SnapEngage.hideButton();
      });
    } 
  };

  s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(se, s);
})();
</script>

4. Go to the page, everything should be ok.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment