Installing Appcues Asynchronously (Developer)

This document includes sample code on how to install Appcues in your web app asynchronously.  With this method he Appcues SDK can be loaded asynchronously, allowing it to load simultaneously with other scripts, which can lessen the impact on page load times.

<script>
  (function() {
    if (!window.AppcuesReady) {
      window.AppcuesReady = function(callback) {
        callback && window.AppcuesReady.q.push(callback);
        if (window.Appcues) {
          while (window.AppcuesReady.q.length) {
            cb = window.AppcuesReady.q.shift();
            if (typeof cb === 'function') cb();
          }
        }
      };
      window.AppcuesReady.q = [];
    }
  })()
</script>

<script>
  // You could then call Appcues methods immediately 
  // by calling AppcuesReady() with a callback:
  AppcuesReady(function() {
    Appcues.identify('userId', {email: 'test@appcues.com'});
  });
</script>

<!-- Load your Appcues script at any time later -->
<script src="//fast.appcues.com/23.js" async defer onload="AppcuesReady()"></script>
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.