We have updated our Webform script so it loads asynchronously, improving user experience. To use it you can go to your webform editor, and find the code under the "Share" tab. It might look like this:

<div id="a5V4sdsaT7"></div>
<script type="text/javascript">
;(function (l, e, a, d, S, i, u, s) {
l[S] || (l.LGN = l.LGN || [], l.LGN.push(S),
l[S] = function () {(l[S].q = l[S].q || []).push(arguments)},
i = e.createElement(a),u = e.getElementsByTagName(a)[0],
i.async = true, i.src = d,u.parentNode.insertBefore(i, u))
}(window, document, 'script', 'https://static.leadsius.com/js/lswf-async.js', 'lswf'));

lswf('showWebform', 'a5V4sdsaT7', 'https://app.leadsius.com','5gxfgAZDA5');
</script>

The new script will load in the background, without blocking the rest of the web page, improving speeds. When the scripts finishes loading, the webform will get shown.
We have added a couple of improvements that might help integrate the webform with your website:

On Error callback

This callback will be called if there is some problem submitting the data to Leadsius.

lswf('showWebform', 'a5V4sdsaT7', 'https://app.leadsius.com','5gxfgAZDA5', function(err) {
    console.log("Webform failed!", err);
});

On Load callback

You can add a callback that will get called when the webform finished loading, here is an example:

lswf('showWebform', 'a5V4sdsaT7', 'https://app.leadsius.com','5gxfgAZDA5', function() {
    console.log("Webform failed!", err);
}, function() {
    console.log("Webform was loaded!");
});

This might be useful if you want to execute some Javascript code after the webform's HTML was loaded.

On Submit callback

You can also add a callback that will get called when the webform was submitted:

lswf('showWebform', 'a5V4sdsaT7', 'https://app.leadsius.com','5gxfgAZDA5', function() {
    console.log("Webform failed!", err);
}, function() {
    console.log("Webform was loaded!");
}, function() {
    console.log("Webform was submitted!");
});

Also useful if you want to show or hide something after the webform was submitted.


We plan on adding new features to our webforms in the future so, stay tuned!

Did this answer your question?