<commit_before>girder.exposePluginConfig('google_analytics', 'plugins/google_analytics/config');
girder.events.on('g:appload.after', function () {

    // We ignore this block of code as it is the standard Google Analytics
    // snippet. We also make sure that JSHint knows we have a ga object for
    // interacting with it.
    /* global ga */
    /* jshint ignore:start */
    (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');
    /* jshint ignore:end */

    girder.restRequest({
        type: 'GET',
        path: 'system/setting',
        data: {
            list: JSON.stringify(['google_analytics.tracking_id'])
        }
    }).done(_.bind(function (resp) {
        ga('create', resp['google_analytics.tracking_id'], 'none');
    }, this));
});<commit_msg>Adding analytics for hierarchy widget routing.<commit_after>girder.exposePluginConfig('google_analytics', 'plugins/google_analytics/config');
girder.events.on('g:appload.after', function () {

    // We ignore this block of code as it is the standard Google Analytics
    // snippet. We also make sure that JSHint knows we have a ga object for
    // interacting with it.
    /* global ga */
    /* jshint ignore:start */
    (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');
    /* jshint ignore:end */

    girder.restRequest({
        type: 'GET',
        path: 'system/setting',
        data: {
            list: JSON.stringify(['google_analytics.tracking_id'])
        }
    }).done(_.bind(function (resp) {
        ga('create', resp['google_analytics.tracking_id'], 'none');
    }, this));
});

/**
 * Add analytics for the hierarchy widget specifically since it routes without
 * triggering (calling navigate without {trigger: true}).
 */
girder.events.on('g:hierarchy.route', function (args) {
    var curRoute = args.route;
    if (!/^\//.test(curRoute)) {
      curRoute = '/' + curRoute;
    }
    ga('send', 'pageview', curRoute);
});
{'fraction_non_alphanumeric': 0.18562144597887897, 'fraction_numerical': 0.002437043054427295, 'mean_word_length': 3.595149253731343, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1452845', 'n_tokens_mistral': 839, 'n_tokens_neox': 823, 'n_words': 153}