(function (window, document) {
  function loadScripts() {
    var scriptsToDefer = JSON.parse(document.getElementById('scriptsToDefer').firstChild.nodeValue);
    var s = document.createElement('script');
    s.type = 'text/javascript';
    s.src = scriptsToDefer;
    document.body.appendChild(s);
  }

  /**
   * Wait until **full page load** before loading JS scripts.
   * Default behavior for `<script async defer ... /> loads scripts after DOMContentReady,
   * which impacts our current LGFE site speed metrics.
   */
  window.addEventListener('load', function () {
    setTimeout(loadScripts);
  });
})(window, document);
