{% if layout.common-ext-js %}
  {% for js in layout.common-ext-js %}
    <script src="{{ js }}"></script>
  {% endfor %}
{% endif %}

{% if page.ext-js %}
  {% for js in page.ext-js %}
    <script src="{{ js }}"></script>
  {% endfor %}
{% endif %}

{% if page.js %}
  {% for js in page.js %}
    <script src="{{ js | absolute_url }}"></script>
  {% endfor %}
{% endif %}

{% if layout.common-js %}
  {% for js in layout.common-js %}
    <!-- doing something a bit funky here because I want to be careful not to include JQuery twice! -->
    {% if js contains 'jquery' %}
      <script>
        if (typeof jQuery == 'undefined') {
          document.write('<script src="{{ js | absolute_url }}"></scr' + 'ipt>');
        }
      </script>
    {% else %}
      <script src="{{ js | absolute_url }}"></script>
    {% endif %}
  {% endfor %}
{% endif %}

{% include google_analytics.html %}
{% if layout.common-ext-js %}
  {% for js in layout.common-ext-js %}
    <script src="{{ js }}" crossorigin="anonymous"></script>
  {% endfor %}
{% endif %}

{% if page.ext-js %}
  {% for js in page.ext-js %}
    <script src="{{ js }}"></script>
  {% endfor %}
{% endif %}

{% if page.js %}
  {% for js in page.js %}
    <script src="{{ js | absolute_url }}"></script>
  {% endfor %}
{% endif %}

{% if layout.common-js %}
  {% for js in layout.common-js %}
    <!-- doing something a bit funky here because I want to be careful not to include JQuery twice! -->
    {% if js contains 'jquery' %}
      <script>
        if (typeof jQuery == 'undefined') {
          document.write('<script src="{{ js | absolute_url }}"></scr' + 'ipt>');
        }
      </script>
    {% else %}
      <script src="{{ js | absolute_url }}"></script>
    {% endif %}
  {% endfor %}
{% endif %}

{% include google_analytics.html %}

Add crossorigin="anonymous" to external JS scripts
Add  crossorigin="anonymous" to external JS scripts