{% if not debug %}
    <script>
      +function(l,y,t,i,c,s) {
        l['LocalyticsGlobal'] = i;
        l[i] = function() { (l[i].q = l[i].q || []).push(arguments) };
        l[i].t = +new Date;
        (s = y.createElement(t)).type = 'text/javascript';
        s.src = '//web.localytics.com/v3/localytics.js';
        (c = y.getElementsByTagName(t)[0]).parentNode.insertBefore(s, c);
        ll('init', 'a62d3f2d950818261a89f2f-70c7cac4-2c9f-11e5-de49-00f078254409', {
          trackPageView: true
        } /* Options */);
        {% if request.user.is_authenticated and not debug %}
          ll('setCustomerID', '{{ request.user.username }}');
        {% endif %}
      }(window, document, 'script', 'll');
    </script>
    <script type="text/javascript">

        var _gaq = _gaq || [];
        _gaq.push(['_setAccount', 'UA-514462-44']);
        _gaq.push(['_trackPageview']);

        {% if blog_user.profile.google_analytics_tracking_id %}
            _gaq.push(['b._setAccount', '{{ blog_user.profile.google_analytics_tracking_id }}']);
            _gaq.push(['b._trackPageview']);
        {% endif %}

        (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>

    <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', '4ed65ee7f5a1f530f1000001');
            t.src = '//secure.gaug.es/track.js';
            var s = document.getElementsByTagName('script')[0];
            s.parentNode.insertBefore(t, s);
        })();
    </script>
    {% if blog_user.profile.gauges_site_id %}
        <script type="text/javascript">
            (function() {
                setTimeout(function() {
                    window._gauges = [];
                    var t   = document.createElement('script');
                    t.type  = 'text/javascript';
                    t.async = true;
                    t.id    = 'gauges-tracker';
                    t.setAttribute('data-site-id', '{{ blog_user.profile.gauges_site_id }}');
                    t.src = '//secure.gaug.es/track.js';
                    var s = document.getElementsByTagName('script')[0];
                    s.parentNode.insertBefore(t, s);
                }, 1000);
            })();
        </script>
    {% endif %}
{% else %}
  <script>
    window.ll = function() {};
  </script> 
{% endif %}
