{% if GOOGLE_ANALYTICS %}
    <script type="text/javascript">
    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', '{{GOOGLE_ANALYTICS}}']);
    _gaq.push(['_trackPageview']);
    (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'https://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
    })();
    </script>

    <!-- Global site tag (gtag.js) - Google Analytics -->
    <script async src="https://www.googletagmanager.com/gtag/js?id={{GOOGLE_ANALYTICS}}"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());
    
      gtag('config', '{{GOOGLE_ANALYTICS}}', {
        'page_title' : '{{ output_file }}',
        'page_path': '{{ output_file }}'
      });
    </script>
{% endif %}
{% if GAUGES %}
    <script type="text/javascript">
    var _gauges = _gauges || [];
    (function() {
        var t   = document.createElement('script');
        t.type  = 'text/javascript';
        t.async = true;
        t.id    = 'gauges-tracker';
        t.setAttribute('data-site-id', '{{GAUGES}}');
        t.src = '//secure.gaug.es/track.js';
        var s = document.getElementsByTagName('script')[0];
        s.parentNode.insertBefore(t, s);
    })();
    </script>
{% endif %}
{% if PIWIK_URL and PIWIK_SITE_ID %}
    <script type="text/javascript">
        var _paq = _paq || [];
{% if PREPEND_DOMAIN %}
      _paq.push(["setDocumentTitle", document.domain + "/" + document.title]);
{% endif %}
{% if TRACK_SUBDOMAINS %}
      _paq.push(["setCookieDomain", "*.{{ DOMAIN }}"]);
{% endif %}
{% if HIDE_CLICK_KNOWN_ALIAS %}
      _paq.push(["setDomains", ["*.{{ DOMAIN }}"]]);
{% endif %}
      _paq.push(["trackPageView"]);
      _paq.push(["enableLinkTracking"]);
      (function() {
          var u="{{ PIWIK_URL }}/";
          _paq.push(["setTrackerUrl", u+'piwik.php']);
          _paq.push(['setSiteId', '{{ PIWIK_SITE_ID }}']);
          var d=document, g=d.createElement("script"), s=d.getElementsByTagName('script')[0];
          g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
      })();
    </script>
{% if TRACK_NO_JAVA %}
    <noscript><p><img src="//analytics.colacoweb.net/piwik.php?idsite=1&rec=1" style="border:0;" alt="" /></p></noscript>
{% endif %}
{% endif %}
