Improving the page speed
Usersnap loads asynchronously and does not block your loading time
Especially, external-facing websites and web applications want to have the best page speed possible.
We are constantly working on improving the speed of loading and executing Usersnap on your site.
Usersnap loads asynchronously to not block the loading time of your website or web application. This is how Google Tag Manager and similar applications work too.
Today's websites and digital products are using a lot of integrated applications and that's increasing the page load in the page speed tests.
How can I improve the page speed with Usersnap?
If you want to increase the results for your page speed, you can use some additional approaches to improve the results.
Please, use the space API key of your account. Don't use the project-specific API key.
1. Load Usersnap on the first scroll of users
<script>
window.addEventListener('scroll', function() {
window.onUsersnapCXLoad = function(api) {
api.init();
}
var script = document.createElement('script');
script.defer = 1;
script.src = 'https://widget.usersnap.com/global/load/[Global API Key]?onload=onUsersnapCXLoad';
document.getElementsByTagName('head')[0].appendChild(script);
}, {once: true});
</script>
2. Load Usersnap delayed a few seconds after the page was loaded
<script>
setTimeout(function() {
window.onUsersnapCXLoad = function(api) {
api.init();
}
var script = document.createElement('script');
script.defer = 1;
script.src = 'https://widget.usersnap.com/global/load/[Global API Key]?onload=onUsersnapCXLoad';
document.getElementsByTagName('head')[0].appendChild(script);
}, 1000);
// 1000ms = 1 second
</script>
Updated about 2 years ago