Loading the feedback tab asynchronously

One thing that we always consider with 3rd party integrations on our site is performance. Where ever possible, we load external scripts asynchronously. The only implementation that doesn't work when loading async is if the remote script uses the document.write() function.

Fortunately, Zendesk's feedback widget doesn't do this, so it can be safely loaded asynchronously to improve page load times (async scripts will load in a seperate browser thread on the client, so no delays at all when using this code):


<script type="text/javascript" src="//assets.zendesk.com/external/zenbox/v2.4/zenbox.js">


And use:

<script type=" text/javascript">
(function() {
  var zd = document.createElement('script');
  zd.type = 'text/javascript';
  zd.async = true;
  zd.src = '//assets.zendesk.com/external/zenbox/v2.4/zenbox.js';
  var s = document.getElementsByTagName('script')[0];
  s.parentNode.insertBefore(zd, s);


Please sign in to leave a comment.