mirror of
https://github.com/zulip/zulip.git
synced 2025-11-10 17:07:07 +00:00
Send only 10% of the events we generate to mixpanel
(imported from commit f5b1b68f81346a90998a8ab6e789151b0e55dba1)
This commit is contained in:
@@ -10,8 +10,17 @@ if (! enable_metrics()) {
|
|||||||
mixpanel.disable();
|
mixpanel.disable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function include_in_sample() {
|
||||||
|
// Send a random sample of events that we generate
|
||||||
|
return Math.random() < 0.1;
|
||||||
|
}
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
$(document).on('compose_started.zephyr', function (event) {
|
$(document).on('compose_started.zephyr', function (event) {
|
||||||
|
if (! include_in_sample()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
mixpanel.track('compose started', {user: page_params.email,
|
mixpanel.track('compose started', {user: page_params.email,
|
||||||
realm: page_params.domain,
|
realm: page_params.domain,
|
||||||
type: event.message_type,
|
type: event.message_type,
|
||||||
@@ -23,6 +32,10 @@ $(function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
$(document).on('narrow_activated.zephyr', function (event) {
|
$(document).on('narrow_activated.zephyr', function (event) {
|
||||||
|
if (! include_in_sample()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var operators = event.filter.operators();
|
var operators = event.filter.operators();
|
||||||
var stream_operands = event.filter.operands('stream');
|
var stream_operands = event.filter.operands('stream');
|
||||||
var subject_operands = event.filter.operands('subject');
|
var subject_operands = event.filter.operands('subject');
|
||||||
|
|||||||
Reference in New Issue
Block a user