(function (
  window,
  document,
  scriptTagName,
  globalName,
  scriptAddress,
  scriptElement,
  otherScriptElement
) {
  window['formest'] = globalName;

  // creates a global variable to delegate, so it will be available before script loaded
  window[globalName] =
    window[globalName] ||
    function () {
      // pushes arguments that were passed to delegate into queue
      // so they can be accessed later from the main script
      (window[globalName].q = window[globalName].q || []).push(arguments);
    };
  // dynamically create a script tag element with async execution
  (scriptElement = document.createElement(scriptTagName)),
    (otherScriptElement = document.getElementsByTagName(scriptTagName)[0]);
  scriptElement.id = globalName;
  scriptElement.src = scriptAddress;
  scriptElement.async = 1;

  // inject the script tag before first script tag found within document
  otherScriptElement.parentNode.insertBefore(scriptElement, otherScriptElement);
})(window, document, 'script', 'formest', 'https://graymattersnyc.embed.formest.co/api/v1/app')