title: Place a script immediately after the opening <body> tag
body: <p>I would like to place a Google tag manager script and according to Google Tag documentation, the script should be placed immediately after the opening  tag. </p>
  
  <p>Since we cannot change the source code, we have to append the script using the following code snippet. </p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  (function () {
      var url = "path/to/js/file";
      var gtm = document.createElement('script');
      gtm.type = 'text/javascript';
      gtm.async = true;
      gtm.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + url;
      var s = document.getElementsByTagName('body')[0];
      s.parentNode.insertBefore(gtm, s);
  })();
  &lt;/script&gt;
  </code></pre>
  
  <p>It is almost the same as Google analytics script snippet. Now the script is appended right  before the body tag. I am not sure if using jQuery method insertAfter is the proper way to do it or if there is a better way!</p>
  
  <p>I appreciate your kind help. </p>