<% if request.user_agent != "monitor" && (current_user.nil? || !Rails.application.config.ga_suppress_admin || !current_user.admin?)  # remove admin users from GA  %>
    <script>
        (function(context) {
            if(context.jamClient) {
                var currentVersion = context.jamClient.ClientUpdateVersion();

                if(currentVersion == null || currentVersion.indexOf("Compiled") > -1) {
                    // don't track dev version of the client
                    context.ga = function() {}
                    return;
                }
            }

            (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
                (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
                    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
            })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
            <% if Rails.env == "development" %>
            ga('create', {'trackingId': '<%= Rails.application.config.ga_ua %>', 'siteSpeedSampleRate': 100, 'cookieDomain': 'none'});
            <% else %>
            ga('create', {'trackingId': '<%= Rails.application.config.ga_ua %>', 'siteSpeedSampleRate': 50, 'cookieDomain': 'jamkazam.com'});
            <% end %>
            ga('require', 'displayfeatures');
            ga('send', 'pageview', {
                dimension1: '<%= ga_user_level %>',
                dimension2: '<%= ga_user_type %>'
            });

        })(window);
    </script>
<% else %>
    <script>
        (function(context) {
            context.ga = function() {}
        })(window);
    </script>
<% end %>