Record basic versions of the operators used in narrows for metrics

(imported from commit 5c7cb3a62ebf0b2c1f0d8e9cae8d845cde9baf56)
This commit is contained in:
Zev Benjamin 2013-05-22 16:08:42 -04:00
parent 2ab5c7dd76
commit 991630c031
1 changed files with 14 additions and 0 deletions

View File

@ -46,8 +46,22 @@ $(function () {
});
});
$(document).on('narrow_activated.zephyr', function (event) {
var operators = event.filter.operators();
var stream_operands = event.filter.operands('stream');
var subject_operands = event.filter.operands('subject');
var reported_operators;
if (operators.length === 1) {
reported_operators = operators[0][0];
} else if (operators.length === 2
&& stream_operands.length !== 0 && subject_operands.length !== 0) {
reported_operators = 'stream and subject';
} else {
reported_operators = 'multiple';
}
metrics.track('narrow activated', {user: page_params.email,
realm: page_params.domain,
operators: reported_operators,
trigger: event.trigger},
function (arg) {
if (arg !== undefined && arg.status !== 1) {