title: What is the best way to include Javascript?
body: <p>Many of the big players recommend slightly different techniques. Mostly on the placement of the new <code>&lt;script&gt;</code>.</p>
  
  <p><a href="https://www.google.com/analytics/settings/check_status_profile_handler" rel="noreferrer">Google Anayltics</a>:</p>
  
  <pre><code>(function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
  </code></pre>
  
  <p><a href="http://developers.facebook.com/docs/reference/javascript/" rel="noreferrer">Facebook</a>:</p>
  
  <pre><code>(function() {
    var e = document.createElement('script'); e.async = true;
    e.src = document.location.protocol +
      '//connect.facebook.net/en_US/all.js';
    document.getElementById('fb-root').appendChild(e);
  }());:
  </code></pre>
  
  <p><a href="http://docs.disqus.com/developers/universal/" rel="noreferrer">Disqus</a>:</p>
  
  <pre><code>(function() {
      var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
      dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
      (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
  })();
  </code></pre>
  
  <p>(post others and I'll add them)</p>
  
  <p>Is there any rhyme or reason for these choices or does it not matter at all?</p>