Created
September 30, 2015 02:24
-
-
Save hijonathan/772c7d883acb0f27f0db to your computer and use it in GitHub Desktop.
Load Appcues asynchronously in a wrapped method.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
(function(a, ns, cb) { | |
window[ns] = function(callback) { | |
(window[ns].q = window[ns].q || []).push(callback); | |
if (window[a] != null) { | |
while (window[ns].q.length) { | |
cb = window[ns].q.shift(); | |
if (typeof cb === 'function') cb(); | |
} | |
} | |
}; | |
})('Appcues', 'AppcuesReady'); | |
</script> | |
<script> | |
// You could then use Appcues immediately by calling Appcues.ready() with a callback: | |
AppcuesReady(function() { | |
Appcues.identify('userId', {email: '[email protected]'}); | |
}); | |
</script> | |
<!-- Load the script at any time later --> | |
<script src="//fast.appcues.com/23.js" async defer onload="AppcuesReady()"> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment