Facebook Messenger Script Delay

I am using google tag manager and need this script to be delayed. There are 2 tricky parts. 1. Once it loads, I don’t want it to be delayed if they go to a different page. 2. I am not a javascript person so this is completely unknown. Below is the code Facebook uses to generate the messenger popup.

<!-- Load Facebook SDK for JavaScript -->
<div id="fb-root"></div>
window.fbAsyncInit = function() {
xfbml : true,
version : 'v8.0'

(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = 'https://connect.facebook.net/en_US/sdk/xfbml.customerchat.js';
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

Source: Ask Javascript Questions