{% if g.theme.jinja_macros %}
    {% import g.theme.jinja_macros as theme_macros with context %}
{% endif %}

<script type="text/javascript">
    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', '{{account}}']);
    {% if c.app and c.app.config -%}
    _gaq.push(['_setCustomVar', 1, 'Page Type', '{{c.app.config.tool_name}}', 3])
    {%- endif %}
    {{theme_macros.custom_ga_js(c.user|default, c.project|default)}}
    _gaq.push(['_trackPageview']);
    _gaq.push(['_trackPageLoadTime']);
    (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);
    })();
</script>
