{% if PIWIK_URL and PIWIK_SITE_ID %}
    <script type="text/javascript">
    {% if PIWIK_SSL_URL %}
        var pkBaseURL = "{{ PIWIK_SSL_URL }}";
    {% else %}
        var pkBaseURL = "{{ PIWIK_URL }}";
    {% endif %}
    var _paq = _paq || [];
    _paq.push(["trackPageView"]);
    _paq.push(["enableLinkTracking"]);
    (function() {
        var u=(("https:" == document.location.protocol) ? "https" : "http")+"://"+pkBaseURL+"/";
        _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.defer=true; g.async=true; g.src=u+"piwik.js"; s.parentNode.insertBefore(g,s);
    })();
    </script>
{% endif %}
