assemblymade/coderwall

View on GitHub
app/views/application/_mixpanel.html.erb

Summary

Maintainability
Test Coverage
<% if ENABLE_TRACKING %>

    <!-- start Mixpanel -->
    <script type="text/javascript">(function (e, b) {
        if (!b.__SV) {
            var a, f, i, g;
            window.mixpanel = b;
            a = e.createElement("script");
            a.type = "text/javascript";
            a.async = !0;
            a.src = ("https:" === e.location.protocol ? "https:" : "http:") + '//cdn.mxpnl.com/libs/mixpanel-2.2.min.js';
            f = e.getElementsByTagName("script")[0];
            f.parentNode.insertBefore(a, f);
            b._i = [];
            b.init = function (a, e, d) {
                function f(b, h) {
                    var a = h.split(".");
                    2 == a.length && (b = b[a[0]], h = a[1]);
                    b[h] = function () {
                        b.push([h].concat(Array.prototype.slice.call(arguments, 0)))
                    }
                }

                var c = b;
                "undefined" !== typeof d ? c = b[d] = [] : d = "mixpanel";
                c.people = c.people || [];
                c.toString = function (b) {
                    var a = "mixpanel";
                    "mixpanel" !== d && (a += "." + d);
                    b || (a += " (stub)");
                    return a
                };
                c.people.toString = function () {
                    return c.toString(1) + ".people (stub)"
                };
                i = "disable track track_pageview track_links track_forms register register_once alias unregister identify name_tag set_config people.set people.increment".split(" ");
                for (g = 0; g < i.length; g++)f(c, i[g]);
                b._i.push([a, e, d])
            };
            b.__SV = 1.2
        }
    })(document, window.mixpanel || []);
    mixpanel.init("<%= ENV['MIXPANEL_TOKEN'] %>", {
        'track_pageview': true,
        'debug': true,
        'verbose': true
    });
    </script><!-- end Mixpanel -->


    <script type="text/javascript">
        adroll_adv_id = "KGZQACVKNRCUTCCXGWXOW7";
        adroll_pix_id = "F3IHUZYRFFHCHE7ZMGC7TX";
        /* OPTIONAL: provide email to improve user identification */
        /* adroll_email = "username@example.com"; */
        (function () {
            var _onload = function(){
                if (document.readyState && !/loaded|complete/.test(document.readyState)){setTimeout(_onload, 10);return}
                if (!window.__adroll_loaded){__adroll_loaded=true;setTimeout(_onload, 50);return}
                var scr = document.createElement("script");
                var host = (("https:" == document.location.protocol) ? "https://s.adroll.com" : "http://a.adroll.com");
                scr.setAttribute('async', 'true');
                scr.type = "text/javascript";
                scr.src = host + "/j/roundtrip.js";
                ((document.getElementsByTagName('head') || [null])[0] ||
                    document.getElementsByTagName('script')[0].parentNode).appendChild(scr);
            };
            if (window.addEventListener) {window.addEventListener('load', _onload, false);}
            else {window.attachEvent('onload', _onload)}
        }());
    </script>

<% end %>